我如何知道是否正在显示 ModalViewController?
当设备处于横向模式时,我在主 ViewController 中重写 -orientationChanged 以推送 ModalViewController A。当放回纵向模式时,ModalViewController A 将被关闭。但是,在其他情况下(按钮触摸后)会显示 ModalViewController B、C 或 D。当这些显示时,如果设备横向旋转并返回,ModalViewController BC 或 D 将被不恰当地关闭。
即使显示 ModalViewController,我也可以验证主 ViewController 上的 -orientationChanged 是否正在发送消息。当显示 ModalViewController BC 或 D 时,是否可以在 -orientationChanged 方法中添加一个条件来绕过该代码?
谢谢你!
I override -orientationChanged in my main ViewController to push ModalViewController A when the device is in landscape mode. When placed back in portrait mode, ModalViewController A is dismissed. However, there are other cases (after button touches) where ModalViewControllers B, C, or D are shown. When those are showing, if the device is turned landscape and turned back, ModalViewController B C or D is dismissed, inappropriately.
I can verify that -orientationChanged on my main ViewController is being messaged even when a ModalViewController is shown. Is there a condition I can add to my -orientationChanged method to bypass that code when ModalViewController B C or D is being shown?
Thank you!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以检查主视图控制器中的 modalViewController 属性是否是您的视图控制器之一。
You can check if the modalViewController property in your main viewcontroller is one of your view controllers.
您可以使用此代码来查找最后一个 ModalViewController 是什么。
You can use this code to find what is the last ModalViewController.