从底部加载导航视图控制器
我有四个ViewController,其中的ViewControllers加载使用UINavigationController
。 我能够切换到每个ViewController一个接一个。
事情是,因为我使用的是NavigationController,所有的ViewController都是从Left或者从Right加载的。 但我想从底部加载ViewController。 我知道我可以使用presentModalViewController
从底部呈现ViewController。 但它不等同于导航控制器,因为从第四个ViewController,如果我按下一个button,我需要来第一个ViewController。
我怎样才能从NavigationController的底部呈现一个ViewController?
尝试这个:
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"];
使用这可能会帮助你
[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];
快乐编码:)
在创buildviewController之后,而不是:
[self.navigationController pushViewController:blablabla animated:YES];
做:
[self presentModalViewController:blablabla animated:YES];
它会来自底部。
回去,只是说:
[self dismissViewControllerAnimated:YES];