iphone - 如何判断是否存在模式 UIViewController?

标签 iphone uiviewcontroller

有没有办法判断是否已经存在模态 UIViewController,例如在调用 dismissModalViewControllerAnimated 之前?

最佳答案

iOS 9、8、7、6 和 5

这个问题的答案太多了,没有一个能涵盖所有情况。此外,尽管您在 documentation 中找到了这些内容。 ,现在已弃用的 modalViewController两种替代方案:

  1. 如果您需要知道是否属于模态:

    BOOL modal = nil != [selfpresentingViewController];

  2. 如果您需要知道您是否被模式覆盖:

    BOOL hideByModal = nil != [selfpresentedViewController];

关于iphone - 如何判断是否存在模式 UIViewController?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6993281/

相关文章:

iphone - 如何加快应用程序的加载时间

iphone - UIButton 的响应时间

iphone - 将整数格式化为 2 位

xcode - 如何从 Storyboard 中制作的弹出窗口中获取变量值? (在 swift 中)

Storyboard上的第二个 ViewController 无法访问 iOS 8 导航栏

ios - 我如何知道哪个 ViewController 处于事件状态?

iphone - 如何将纯色应用于 UISearchBar

iPhone SDK : Image arrays?

ios - Swift iOS 应用程序最佳方法 - Book With Input

ios - Segue 动画类似于在 iOS 7 中打开应用程序 : viewcontroller frame is not resizable