当出现modalView时,网络事件会生成一个新的模态视图控制器。我在做什么是连锁presentViewController:动画dismissViewControllerAnimated内:是这样完成:当链dismissViewControllerAnimated时出错:完成和presentViewController:动画
// ModalViewController *vc = ...
if (self.presentedViewController) {
__weak MyViewController *me = self;
[self.presentedViewController dismissViewControllerAnimated:YES
completion:
^{
// need a delay to call?
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[me presentViewController:vc
animated:YES
completion:nil];
});
}];
}else{
[self presentViewController:vc animated:YES completion:nil];
}
一切顺利:视图 - 控制辞退原来的模式,产生的网络一一呈现,并且用户可以成功地驳回。
2014-03-26 15:49:52.111 coshop[6046:60b] Warning: Attempt to dismiss from view controller <RootViewController: 0xa8b54a0> while a presentation or dismiss is in progress!
我也试过这样:
if (self.presentedViewController) {
__weak MyViewController *me = self;
[self.presentedViewController dismissViewControllerAnimated:YES
completion:nil];
// dismiss animation ends within 0.5.
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[me presentViewController:vc
animated:YES
completion:nil];
});
}else{
[self presentViewController:vc animated:YES completion:nil];
}
任何建议然而,试图提出一个3 modalViewController时,失败,错误?谢谢!
当前模态仍然不变时,您是否不想不动画?然后将当前模态降低?的确,为什么这么多的模式? – Wain
你想达到什么目的?听起来像很多模态窗口 –
是的,确实很多模态视图。第一个模式视图是用户生成的,第二个是生成的网络事件,第三个是用户再次生成的。这个问题似乎有些缺失,所以当第二个被解散时,系统并不这么认为 - 所以无法呈现第三个。 – wangii