zoukankan      html  css  js  c++  java
  • iOS presentViewController 方法引起的问题

    有个需求,在项目中随时使用 presentViewController来显示一个界面,比如弹窗提示或者人脸解锁,都是在任何情况都可能出现的。

    在presentViewController 调用前,已经有提示框了;因为系统用的是UIAlertController,这样的话是无法执行下一个弹窗的,

    看了网上的方法直接获取根视图 调用,方法是可以的,但会出现之前的弹窗错位,可以尝试把之前的弹窗删除

    有必要的话 删除前记录弹窗内容,解决当前的后,在弹出原来的;

     

    //获取根视图

    UIViewController *appRootVC = [UIApplication sharedApplication].keyWindow.rootViewController;

            UIViewController *topVC = appRootVC;

     

            if (topVC.presentedViewController) {

    //有么有persentview  有了删除

                topVC = topVC.presentedViewController;

                [topVC dismissViewControllerAnimated:NO completion:nil];

            }

     

    //根视图跳转

        [appRootVC presentViewController:dvc animated:YES completion:nil];

  • 相关阅读:
    poj 2000
    poj1316
    poj1922
    poj2017
    poj1833 排列
    poj1338
    poj2136
    poj2242
    IE兼容html5标签
    绑定事件后,某些情况下需要解绑该事件
  • 原文地址:https://www.cnblogs.com/xujiahui/p/9780235.html
Copyright © 2011-2022 走看看