2014-10-09 30 views
0

我打電話presentModal方法上viewDidAppear使用:警告:試圖提出模態時,通知被稱爲

[[NSNotificationCenter defaultCenter] addObserver:self   
              selector:@selector(presentModal)   
               name:@"xxxxxxx"   
               object:nil]; 

-(void)presentModal 
{ 
    PickerModalViewController *pickerModalViewController = [Appdelegate.window.rootViewController.storyboard instantiateViewControllerWithIdentifier:@"PickerModalViewController"]; 

    pickerType = 2; 
    pickerModalViewController.choices = self.localArray; 
    pickerModalViewController.buttonTag = pickerType; 

    pickerModalViewController.delegate = self; 
    self.pickerPresenter = self; 

    if (self.pickerPresenter) { 
     [self.pickerPresenter presentViewController:pickerModalViewController animated:YES completion:nil]; 
    } 
} 

時提出拾取它讓我在兩個器件和模擬器華林

警告:Attempt to present PickerModalViewController: 0x10ec7280 on UINavigationController: 0x90ad610 while a presentation is in progress!

回答

0

警告告訴你,什麼是錯的。 爲了避免這個警告,您可以使用的UINavigationController的delegate財產和實施

- (void)navigationController:(UINavigationController *)navigationController didShowViewController:(UIViewController *)viewController animated:(BOOL)animated