2016-06-08 45 views
-1

我正在開發iPad應用程序。在這個應用中我顯示的ViewController在presentViewController使用這個下面的代碼UIPopoverController不呈現在「presentViewController」

[self presentViewController:vc animated:YES completion:nil];

之後我顯示在瞭解僱「VC」是presentviewController使用UIPopoverController彈出。所以我得到以下問題Warning: Attempt to present <SelectionListViewController: 0x7b439960> on <ViewController: 0x7a341e00> which is already presenting (null)

因此,彈出窗口不顯示在ViewController上。如何解決這個問題。這是現在我需要解決這個問題的項目。

由於提前

回答

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]; 
         }]; 
+0

我試過了。但它不起作用。 – iSara

+0

你是否試過這個完整的代碼? –

+0

試試這個 dispatch_async(dispatch_get_main_queue(),^ {presentpriceViewController:vc animated:YES completion:nil]; }); –

0

我覺得presentViewController在performSelector通話將解決您的問題。 試試這個2種方法

-(void) present 
{ 
    [self performSelector: @selector(ShowSelectionListViewController) withObject: nil afterDelay: 0]; 
} 

-(void) ShowSelectionListViewController 
{ 
    [self presentViewController:SelectionListViewController animated: true completion: nil]; 
} 
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 ]; 
     } 
+0

它不工作。我認爲它是不同的問題。 – iSara

相關問題