【发布时间】:2014-11-03 08:00:12
【问题描述】:
为什么 iOS7 中的 UIAlertController 收到 nil 值而需要呈现但在 iOS8 中工作很好,我知道这是因为 iOS7 不支持 UIAlertController 类吗?
UIAlertController *view=[UIAlertController
alertControllerWithTitle:@"Hello"
message:nil
preferredStyle:UIAlertControllerStyleAlert];
[self presentViewController:view animated:NO completion:nil];
【问题讨论】:
-
UIAlertController 是为 iOS 8 引入的。它在 iOS7 中不起作用。对于 iOS7,您应该使用 UIAlertView。
-
我创建了一个简单的包装类,可以同时使用两者。它模仿 UIAlertController。 github.com/Reggian/RAAlertController
标签: ipad ios7 ios8 uialertcontroller