I'm using ECSlidingViewController.
In the sample project i added a button on the First view with an IBAction
I want the button on the First view to go to the second view (without using the slide out navigation).
- (IBAction)btnPressed:(id)sender {
UIViewController *newTopViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"SecondTop"];
[self.slidingViewController anchorTopViewOffScreenTo:ECRight animations:nil onComplete:^{
CGRect frame = self.slidingViewController.topViewController.view.frame;
self.slidingViewController.topViewController = newTopViewController;
self.slidingViewController.topViewController.view.frame = frame;
[self.slidingViewController resetTopView];
}];
}
With this code it only goes to the navigation slide out menu and doesn't go to the Second
Don't always use
self.slidingViewController
. It's a derived property, not a static value. So what's happening is that you replace the first view with the second view and then the first view can't get the sliding controller any more (you broke its reference). So, do this instead: