Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SASlideMenuDelegate #89

Closed
mjeragh opened this issue Aug 5, 2013 · 4 comments
Closed

SASlideMenuDelegate #89

mjeragh opened this issue Aug 5, 2013 · 4 comments

Comments

@mjeragh
Copy link

mjeragh commented Aug 5, 2013

First Thank you for this great framework.

I would to invoke a method on my viewcontroller which slide to the left in the delegate slideMenuWillSlidetoSide. How can I get a hold of the view controller. I tried self.rootViewController with no luck since it is a forward declaration.
Please help.

@mjeragh
Copy link
Author

mjeragh commented Aug 5, 2013

Let me rephrase my question, How can I get a reference to the UIViewController in any of the SASlideMenueDelegate?
Thanks in advance

@stefanoa
Copy link
Owner

stefanoa commented Aug 5, 2013

Ok, now I understand. I should modify the protocol and create a new major version.

@mjeragh
Copy link
Author

mjeragh commented Aug 5, 2013

I made it through modification of the class SASlideMenuRootViewController

-(void) doSlideToSide{
if ([self.leftMenu.slideMenuDelegate respondsToSelector:@selector(slideMenuWillSlideToSide)]){
//[self.leftMenu.slideMenuDelegate slideMenuWillSlideToSide];
[self.leftMenu.slideMenuDelegate slideMenuWillSlideToSide:self.selectedContent];
}
....
}

Added -(void)slideMenuWillSlideToSide:(UINavigationController *)selectedContent; to the delegate file

Finally implemented the method in my main menu class

-(void)slideMenuWillSlideToSide:(UINavigationController )selectedContent{
UIViewController
controller = [selectedContent.viewControllers objectAtIndex:0];
if ([controller isMemberOfClass:[GameViewController class]]) {
[(GameViewController *)controller stopTimer];
}
}

Once again thank you for this excellent framework.

@stefanoa
Copy link
Owner

stefanoa commented Aug 6, 2013

Yes exactly that way.
I am not sure but probably you should change:

if ([self.leftMenu.slideMenuDelegate respondsToSelector:@selector(slideMenuWillSlideToSide)]){

to

if ([self.leftMenu.slideMenuDelegate respondsToSelector:@selector(slideMenuWillSlideToSide:)]){

I think that if you change the delegate you have to add the colon at the end selector name.
As soon as I find some time I will add it.

stefanoa added a commit that referenced this issue Aug 21, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants