当我尝试以模态方式呈现第二个VC时,我收到此警告。
Warning: Attempt to present <RCTAddCardViewController: 0x1f5b21e0> on <IRSlidingSplitViewController: 0x1f538140> while a presentation is in progress!
以下是我的表现:
UIViewController *pvc = [self presentingViewController];
[self dismissViewControllerAnimated:YES completion:^{
RCTAddCardViewController *vc = [[RCTAddCardViewController alloc] initWithNibName:nil bundle:nil];
[pvc presentViewController:vc animated:YES completion:nil];
}];
我不应该在第一次VC被解雇的完成处理程序中出现错误bc。有人知道如何让它消失吗?
答案 0 :(得分:1)
由于您在-dismissViewControllerAnimated:
上呼叫self
,如果您还要通过self
呈现视图控制器,则该视图控制器将被解除(因此pvc
仍会提出self
)。如果那不是问题,我想它只会在完成块返回后计算完成。
一种解决方法是创建-myPresentViewController:
方法,然后使用
[self performSelector:@selector(presentViewController:) withObject:vc afterDelay:0.001]
块内的