【发布时间】:2015-05-20 13:45:47
【问题描述】:
我试图在ViewWillAppear 上创建一个UIAlertController,它给了我以下警告。
"Warning: Attempt to present <UIAlertController: 0x7f8798c15df0> on <ViewController: 0x7f8798f81450> whose view is not in the window hierarchy!".
我的理解它已经准备好在ViewWillAppear 中向用户显示视图,但相当昂贵。
但是,当我将相同的 UIAlertController 代码移动到 ViewDidAppear 时,它显示了警报消息。
您能否澄清一下ViewWillAppear 中没有显示警报消息。
【问题讨论】:
-
放到
–viewDidAppear:方法中,说法正确,–viewWillAppear:方法调用时你的视图不在视图层次结构中。 -
viewdidappear 出现同样的错误
标签: ios cocoa-touch objective-c-blocks