在我的视图控制器代码中,我如何区分:
- 情态呈现
- 推送到导航堆栈上
在这两种情况下,presentingViewController
和isMovingToParentViewController
都是YES
,所以没有多大帮助.
更复杂的是,我的父视图控制器有时是模态的,要判断的视图控制器被推到它上面.
原来我的问题是我把我的HtmlViewController
块嵌入UINavigationController
块,然后再拿出来.这就是为什么我自己的try 和下面的好答案没有奏效.
HtmlViewController* termsViewController = [[HtmlViewController alloc] initWithDictionary:dictionary];
UINavigationController* modalViewController;
modalViewController = [[UINavigationController alloc] initWithRootViewController:termsViewController];
modalViewController.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
[self presentViewController:modalViewController
animated:YES
completion:nil];
我想我最好告诉我的视图控制器它什么时候是模式的,而不是试图确定.