如果給UIViewController添加作為modal的UINavigationController。
有一個flow,在firstViewController
中開始,然後在view中調用secondViewController
。
- (IBAction)PressButton:(id)sender {
SecondViewController *second = [[SecondViewController alloc] init];
second.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
UINavigationController *nav = self.navigationController;
[nav presentViewController:second animated:YES completion:nil];
}
在secondViewController 中希望能推進thirdViewController
,但是沒有用,我用了下面的方法嘗試:
- (IBAction)pressButton:(id)sender {
ThirdViewController *tvc = [[ThirdViewController alloc] init];
UINavigationController *nav = self.navigationController;
[nav pushViewController:tvc animated:YES];
}
點擊 secondViewController 時完全沒有反應。
請高手指點一下哪裡出錯了,謝謝
我用的:
OSX 10.8.2
Xcode 4.6
iOS 6.1
將第二個view作為導航控制器的root,同時從所屬的view中調用當前ViewController
- (IBAction)PressButton:(id)sender {
SecondViewController *second = [[SecondViewController alloc] init];
second.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:second];
[self presentViewController:navigationController animated:YES completion:nil];
}