UIAlertView,ActionSheet 选择之后调用rootViewController报错

获取rootViewController 的两种方式分别是:

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

AppDelegate appdelegate=(AppDelegate)[UIApplication sharedApplication].delegate;
UIViewController *rooViewController= [appdelegate window].rootViewController;

image.png

当UIAlertView ,ActionSheet 代理方法之后调用1.root 对象UIApplicationRotationFollowingController,2. rooViewController依然是你设置的windows.rootViewController

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 你一般怎么获取工程中window上面的RootViewController 第一种方法: UIWindow *wi...
    闲云清烟阅读 2,559评论 1 1
  • 1,Search Bar 怎样去掉背景的颜色(storyboard里只能设置background颜色,可是发现cl...
    以德扶人阅读 2,461评论 2 50
  • 概述 在多数移动应用中任何时候都只能有一个应用程序处于活跃状态,如果其他应用此刻发生了一些用户感兴趣的那么通过通知...
    莫离_焱阅读 6,560评论 1 8
  • 《山河故人》的结尾,冰天雪地里,沈涛牵着那条老狗出门,独自在文峰塔前跳舞。《GO WEST》的音乐响起,仿佛又回到...
    甘球阅读 3,480评论 6 32