我正在开发iPad应用程序。在这个应用程序中,我使用以下代码
在presentViewController中显示ViewController
[self presentViewController:vc animated:YES completion:nil];
之后我在那个presentviewController中使用UIPopoverController显示弹出窗口而没有解雇&#34; vc&#34;。所以我在问题 Warning: Attempt to present <SelectionListViewController: 0x7b439960> on <ViewController: 0x7a341e00> which is already presenting (null)
因此,ViewController上没有显示弹出窗口。如何解决这个问题。这是现有项目,我现在需要解决这个问题。
先谢谢
答案 0 :(得分:0)
以这种方式出现......
vc.modalPresentationStyle = UIModalPresentationPopover;
UIPopoverPresentationController *popController = [vc popoverPresentationController];
popController.permittedArrowDirections = UIPopoverArrowDirectionAny;
popController.sourceView = self.view;
[[NSOperationQueue mainQueue] addOperationWithBlock:^{
[self presentViewController:vc animated:YES completion:nil];
}];
答案 1 :(得分:0)
我认为performSelector调用中的presentViewController将解决您的问题。 试试这2个方法
-(void) present
{
[self performSelector: @selector(ShowSelectionListViewController) withObject: nil afterDelay: 0];
}
-(void) ShowSelectionListViewController
{
[self presentViewController:SelectionListViewController animated: true completion: nil];
}
答案 2 :(得分:0)
你应该尝试这个。它对我有用......
if([AppDelegate isIOS8])
{
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.0 * NSEC_PER_SEC)), dispatch_get_main_queue(),
^{[self.popover presentPopoverFromRect:popoverRect
inView:self.view
permittedArrowDirections:UIPopoverArrowDirectionUp
animated:YES];});
}
else
{
[self.popover presentPopoverFromRect:popoverRect
inView:self.view
permittedArrowDirections:UIPopoverArrowDirectionAny
animated:YES ];
}