当我尝试以模态方式呈现第二个 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 解雇的完成处理程序中。任何人都知道让这个消失的方法吗?
最佳答案
由于您在 self
上调用 -dismissViewControllerAnimated:
,如果您还通过 self
呈现 View Controller ,则该 View Controller 将被解雇(因此 pvc
仍将呈现 self
)。如果这不是问题,我想它只会在完成 block 返回后才算完成演示。
一种解决方法是创建一个 -myPresentViewController:
方法,然后使用 use
[self performSelector:@selector(presentViewController:) withObject:vc afterDelay:0.001]
block 内
关于ios - View Controller Presentation Warning - 同时呈现两个,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15868816/