Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to push multiple view controllers into UINavigation but only show animation once?

Tags:

ios

Actually, I know how to push multiple viewControllers. My question focus on the animation.In a UINavigationcontroller, I try to push two viewControllers. And I cancel the animation of the first push. However, in iPhone 6, iOS9.0 simulator, and iphone6 plus iOS9.0 real device, two animations are visible... My code is following:

UINavigationController *a = (UINavigationController *)(self.tabBarController.selectedViewController);
Second11ViewController *view11 = [[UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:@"second1"];
Second22ViewController *view22 = [[UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:@"second2"];
view11.hidesBottomBarWhenPushed = YES;
view22.hidesBottomBarWhenPushed = YES;
[a pushViewController:view11 animated:NO];
[a pushViewController:view22 animated:YES];

Any trick to do this. I want to show animation exactly once, like I just push one viewController (actually two)..

like image 981
seguedestination Avatar asked Dec 22 '25 22:12

seguedestination


1 Answers

Try to use

[a setViewControllers:@[view11, view22] animated:YES];

Hope this would be help to you :)

Exactly, view11 will not be loaded before you pop out view22.

like image 99
Alex Avatar answered Dec 24 '25 10:12

Alex



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!