Question

When you open and close the menu with the button it just snaps shut, however, when you click on an item withing the menu it bounces to the other side and then back again.

Although this is a nice effect it does not work so will with what I am doing presently, can this be disabled? I simply want it to snap shut when the user clicks a menu item.

EDIT

The code in didSelectecItemAtIndex is

UIViewController *newTopViewController = [self.storyboard instantiateViewControllerWithIdentifier:identifier];
[self.slidingViewController anchorTopViewOffScreenTo:ECLeft animations:nil onComplete:^{
        CGRect frame = self.slidingViewController.topViewController.view.frame;
        self.slidingViewController.topViewController = newTopViewController;
        self.slidingViewController.topViewController.view.frame = frame;
        [self.slidingViewController resetTopView];
    }];
Was it helpful?

Solution

I have the same problem but I found the solution. Here is my code:

[self.slidingViewController anchorTopViewOffScreenTo:ECANCELED animations:nil onComplete:^{
            ObjHomeView.navigationItem.title=[[dataList objectAtIndex:indexPath.row] objectForKey:@"Menu_Name"];
            CGRect frame = self.slidingViewController.topViewController.view.frame;
            self.slidingViewController.topViewController = ObjHomeView;
            self.slidingViewController.topViewController.view.frame = frame;
            [self.slidingViewController resetTopView];
        }];

Here

[self.slidingViewController anchorTopViewoffScreenTo:ECANCELED animations:nil onComplete:^{
 You can put your code

}];

just put the argument ECCANCELED . I hope your problem will be solved.

OTHER TIPS

anchorTopViewOffScreenTo:animations:onComplete: and resetTopView are methods that cause the top view to move.

It sounds like you just want to set a new topViewController and resetTopView like this:

UIViewController *newTopViewController = [self.storyboard instantiateViewControllerWithIdentifier:identifier];
CGRect frame = self.slidingViewController.topViewController.view.frame;
self.slidingViewController.topViewController = newTopViewController;
self.slidingViewController.topViewController.view.frame = frame;
[self.slidingViewController resetTopView];
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top