从底部加载导航ViewController [英] Load a Navigation ViewController from bottom
问题描述
我有四个ViewController,其中ViewControllers使用 UINavigationController
加载。我可以一个一个地切换到每个ViewController。
I am having four ViewControllers , where the ViewControllers are loaded using the UINavigationController
. I am able to switch to every ViewController one by one.
事情是,因为我使用NavigationController所有的ViewController是从左或右。但我想从底部加载ViewController。我知道我可以使用 presentModalViewController
从底部呈现ViewController。但它不等同于导航控制器,因为从第四个ViewController,如果我按一个按钮,我需要来到第一个ViewController。
The thing is, since I am using the NavigationController all the ViewControllers are loaded either from the Left or from the Right. But I want to load the ViewController from the Bottom. I know I can use presentModalViewController
to present the ViewController from the Bottom. But it is not equivalent to the Navigation Controller because , from the 4th ViewController, If I press one button , I need to come to the 1st ViewController.
如何展示从导航控制器底部的ViewController
How can I present a ViewController from the bottom in the NavigationController ?
推荐答案
尝试:
CATransition *animation = [CATransition animation];
[animation setDuration:2];
[animation setType:kCATransitionPush];
[animation setSubtype:kCATransitionFromTop];
[animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
SecondView *sObj=[[SecondView alloc] initWithNibName:@"SecondView" bundle:nil];
[self.navigationController pushViewController:sObj animated:YES];
[[sObj.view layer] addAnimation:animation forKey:@"SwitchToView1"];
这篇关于从底部加载导航ViewController的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!