当设备处于横向模式时,我在主 ViewController 中重写 -orientationChanged 以推送 ModalViewController A。当放回纵向模式时,ModalViewController A 将被关闭。但是,在其他情况下(按钮触摸后)会显示 ModalViewController B、C 或 D。当这些显示时,如果设备横向旋转并返回,ModalViewController B C 或 D 会被不恰本地关闭。
即使显示 ModalViewController,我也可以验证主 ViewController 上的 -orientationChanged 是否正在发送消息。当显示 ModalViewController B C 或 D 时,是否可以在 -orientationChanged 方法中添加一个条件来绕过该代码?
谢谢!
最佳答案
您可以检查主视图 Controller 中的 modalViewController 属性是否是您的 View Controller 之一。
关于iphone - 我如何知道是否正在显示 ModalViewController?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3539262/