iphone - 我如何知道是否正在显示 ModalViewController?

标签 iphone uiviewcontroller modalviewcontroller

当设备处于横向模式时,我在主 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/

相关文章:

iphone - iOS 4.3 上的cameraOverlayView问题

iphone - iPad 2 和最新 iPod 的 systemInfo.machine 值

ios - 'UIViewController' 不是 'ViewController' 的子类型

iphone - 在 xcode 4 中编译时模态视图不起作用

ios - 从模式中选择数据后如何在 UITableViewCell 中刷新 UITextField

ios - 不希望模态视图在键盘显示上向上移动

iphone - 如何从触摸事件中获取信息?

iphone - 在 Safari 中拦截 URL 和打开 URL

ios - 页面加载后 NSNotification 发送的数据为空白

ios - 在所有 subview 自动布局之前调用 viewWillTransitionToSize