當出現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