UINavigationController子VC上未调用supportedInterfaceOrientations

时间:2015-01-07 05:04:38

标签: ios iphone swift

我有3个vcs(比如VC_A,VC_B,VC_C,全部嵌入在导航控制器中,它有一个子类uinavigationcontroller类(比如说MyNavClass)。在MyNavClass中我覆盖了supportedInterfaceOrientations()。

在这个方法中,我有一个这样的陈述:

NSLog(self.topViewController.restorationIdentifier!)

无论出于何种原因,当我浏览视图链时,只有VC_A被记录到控制台,而不是VC_B和VC_C。有什么想法吗?

VC_A有一个导航栏导航到VC_B。 VC_B具有集合视图,并且在选择此集合视图中的项目时,将显示VC_C。您可以使用导航栏后退按钮一直导航回VC_A。

我也尝试了如下的各种组合但没有效果:

NSLog(self.visibleViewController!.restorationIdentifier!)
NSLog(self.navigationController?.viewControllers.last.name)
编辑:我刚刚意识到当VC_B和VC_C被推送到导航控制器时,根本没有调用supportedInterfaceOrientations!为什么会这样呢?怎么解决这个问题?

0 个答案:

没有答案