我在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 :(得分:0)
警告告诉你,出了什么问题。
要避免此警告,您可以使用UINavigationController的delegate
属性并实现
- (void)navigationController:(UINavigationController *)navigationController
didShowViewController:(UIViewController *)viewController
animated:(BOOL)animated