【发布时间】:2015-03-20 03:18:04
【问题描述】:
在显示UIAlertController 后,我尝试关闭UIViewController。
这是我的代码:
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:title
message:msg
preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *okAction = [UIAlertAction actionWithTitle:@"Accept"
style:UIAlertActionStyleDefault
handler:^(UIAlertAction *action)
{
[self dismissViewControllerAnimated:YES completion:nil];
}];
[alertController addAction:okAction];
[self presentViewController:alertController animated:YES completion:^{}];
但是,self 永远不会被解雇。有谁知道如何解决这个问题?
更新
如果我在块外设置[self dismissViewControllerAnimated:YES completion:nil];,它就可以工作。
【问题讨论】:
标签: ios iphone uiviewcontroller uialertcontroller