美文网首页
iOS9下 app的 rootViewController

iOS9下 app的 rootViewController

作者: Mikayla321 | 来源:发表于2017-12-15 12:34 被阅读0次

    本文所有的结论都是在iOS9的情况下。

    先来看看UIWindow 的一些子类,如下图所示。

    Snip20160105_9

    1、目前UIWindow 的 windowLevel 的取值范围是 (0.0-10000000.0)

    2、如果新建一个window,想把它变为keyWindow,这个window是局部变量的时候,会没有效果。

    3、并不是执行了makeKeyAndVisible/makeKeyWindow/becomeKeyWindow 方法 ,window 就一定会变成keyWindow。比如,当系统AlertView 出现时,keyWindow是_UIAlertControllerShimPresenterWindow,这个时候keyWindow 就是不可覆盖的。

    4、_UIAlertControllerShimPresenterWindow 这个系统AlertView的载体window 不在[UIApplication sharedApplication].windows 数组中。

    5、当判断或设置 app的 rootViewController的时候,推荐使用[[UIApplication sharedApplication].delegate window].rootViewController 而不是[[UIApplication sharedApplication]keyWindow].rootViewController,后者偶尔会出现它并不是你想要的那个controller。

    链接:http://www.jianshu.com/p/d9b7d53749fd

    相关文章

      网友评论

          本文标题:iOS9下 app的 rootViewController

          本文链接:https://www.haomeiwen.com/subject/guorwxtx.html