2013-04-07 43 views
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]; 
}]; 

BC它被提出的第一个VC的解雇完成处理程序中我不应该得到的错误。任何人都知道一种方法让这个消失?

回答

1

既然你呼吁self-dismissViewControllerAnimated:,如果你还self呈现视图控制器,该视图控制器将被解雇(所以pvc仍然会呈现self)。如果这不是问题,我想它只会在完成块返回后计数完成。

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

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

+0

内出于某种原因,当我尝试'在调试PO pvc'我得到一个零 – 2013-04-08 00:42:45

+0

你如果你在'UIViewController * pvc = [self presentingViewController]'后面添加'NSLog(@“%@”,pvc)'', – baris 2013-04-08 00:59:31

+0

那个可以工作。有趣的是'po pvc'也开始不是零。 – 2013-04-08 03:01:09

相关问题