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

SASlideMenuRootViewController controllerForIndexPath and switchToContentViewController #118

Open
heyalexchoi opened this issue Apr 14, 2014 · 4 comments

Comments

@heyalexchoi
Copy link

Hey, I was wondering if the SASlideMenuRootViewController methods controllerForIndexPath and switchToContentViewController are supposed to enable a non-animated switch in the content view controller.

I know that the slide menu method selectContentAtIndexPath allows a programmatic segue, but it shows a menu closing animation.

Looks like the SASlideMenuRootViewController's ->controllers only becomes something when the method addContentViewController is called.

Just want to make sure I'm not missing anything.

@stefanoa
Copy link
Owner

Hi Alex,
I am not sure I understand your question.
The method switchToContentViewController perform the animations and is used by the SASlideMenuContentSegue, the SASlideMenuViewController and the SASlideMenuRootViewController. The method controllerForIndexPath is simply a method used to access the controllers dictionary in other words it is method to access the cache containing the controllers.

@heyalexchoi
Copy link
Author

Ah, ok, I think I understand better now.

What would you say is the best way to extend SASlideMenu's functionality to change content view controllers without an animation?

@heyalexchoi
Copy link
Author

After experimenting with a few different methods, the best way I found was to manipulate the slide menu data source / delegate, like so:

// The duration of the animation
-(CGFloat) slideInAnimationDuration
{
    if (self.disableSlideAnimation)
    {

        return 0;
    }
    return .5;
}

// The duration of the animation
-(CGFloat) slideOutAnimationDuration
{

    if (self.disableSlideAnimation)
    {

        return 0;
    }
    return .5;
}


// If it returns true when switching between content view controller the deselected one will slide out before the selected one will slide in.
-(Boolean) slideOutThenIn;
{
    if (self.disableSlideAnimation)
    {
        return NO;
    }
    return YES;
}

Although I am still having trouble finding a good way to access the navigation controller I just switched to. Looks like this is primarily accounted for in the private property selectedContent.

@stefanoa
Copy link
Owner

Hi Alex,

The hack you are using seems ok to me, in future versions I will add the ability to switch without animations.
The navigation controller should be accessible from the content view controller using the UIViewController property:

@property(nonatomic, readonly, retain) UINavigationController *navigationController

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