UIViewController *topRootViewController = [UIApplication sharedApplication].keyWindow.rootViewController;
while (topRootViewController.presentedViewController)
{
topRootViewController = topRootViewController.presentedViewController;
}
//[topRootViewController presentViewController:yourController animated:YES completion:nil];
//or
[topRootViewController myMethod];
Whose view is not in the window hierarchy 错误
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
推荐阅读更多精彩内容
- AppDelegate *aa=(AppDelegate *)[UIApplication sharedAppli...
- 在iOS 中弹窗时有时会失败,打印下面的错误信息 调用方法是 原因是因为self有可能不是顶层窗口,改用下面的方式...
- UIViewController *topRootViewController = [[UIApplication...
- 新建了一个工程使用下面获取rootVC用来弹窗时,弹出不来,发现RootViewControlle是nil 需要删...
- 报错 Warning: Attempt to present <UIAlertController: 0x7fe9...