iOS presentViewController 方法引发的问题

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

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

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

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

 

//获取根视图class

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

        UIViewController *topVC = appRootVC;im

 

        if (topVC.presentedViewController) {项目

//有么有persentview  有了删除margin

            topVC = topVC.presentedViewController;top

            [topVC dismissViewControllerAnimated:NO completion:nil];

        }

 

//根视图跳转

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

相关文章
相关标签/搜索