1

当我尝试以模态方式呈现第二个 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 解雇的完成处理程序中。有谁知道让这个消失的方法吗?

4

1 回答 1

1

由于您正在调用-dismissViewControllerAnimated:self如果您还通过 呈现视图控制器self,则该视图控制器将被解除(因此pvc仍将呈现self)。如果这不是问题,我想它只会在完成块返回后才计算完成。

一种解决方法是创建一个-myPresentViewController:方法,并使用 use

[self performSelector:@selector(presentViewController:) withObject:vc afterDelay:0.001]

块内

于 2013-04-07T23:04:37.647 回答