2

我有四个 ViewControllers ,其中 ViewControllers 使用UINavigationController. 我能够一个一个地切换到每个 ViewController。

问题是,由于我使用的是 NavigationController,所有 ViewController 都是从左侧或右侧加载的。但我想从底部加载 ViewController。我知道我可以用来presentModalViewController从底部展示 ViewController。但它不等同于导航控制器,因为从第 4 个 ViewController,如果我按下一个按钮,我需要来到第 1 个 ViewController。

如何从 NavigationController 的底部呈现 ViewController ?

4

3 回答 3

10

尝试这个:

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"]; 
于 2012-08-09T09:05:42.413 回答
0

使用这个可能会帮助你

[UIView beginAnimations:@"Hide Me" context:nil];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationDuration:kAnimationDur];
subScroll.frame = CGRectMake(0,ksubScrollHideY,ksubScrollW,ksubScrollH);
clickPic.frame = CGRectMake(kButtonX,kButtonHiddenY,kButtonW,kButtonH);
[UIView setAnimationDelegate:self];
[UIView commitAnimations];

快乐编码:)

于 2012-08-09T09:47:18.553 回答
-2

创建 viewController 后,而不是:

[self.navigationController pushViewController:blablabla animated:YES];

做:

[self presentModalViewController:blablabla animated:YES];

它将来自底部。

要回去,只需说:

[self dismissViewControllerAnimated:YES];
于 2012-08-09T08:47:05.563 回答