Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 检测UIPopoverController何时完成显示UIImageViewcontroller_Ios_Uiimagepickercontroller_Uipopovercontroller - Fatal编程技术网

Ios 检测UIPopoverController何时完成显示UIImageViewcontroller

Ios 检测UIPopoverController何时完成显示UIImageViewcontroller,ios,uiimagepickercontroller,uipopovercontroller,Ios,Uiimagepickercontroller,Uipopovercontroller,我使用UIImagePickerController作为UIPopoverController的内容视图控制器。我需要检测popover何时刚刚完成呈现(刚刚出现)。UIPopoverController对此没有任何委托。我似乎也找不到检测UIImagePickerController的方法。(这是iPad的) 有什么建议吗 // UIImagePickerController let's the user choose an image. UIImagePickerController *im

我使用UIImagePickerController作为UIPopoverController的内容视图控制器。我需要检测popover何时刚刚完成呈现(刚刚出现)。UIPopoverController对此没有任何委托。我似乎也找不到检测UIImagePickerController的方法。(这是iPad的)

有什么建议吗

// UIImagePickerController let's the user choose an image.
UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
imagePicker.delegate = self;
self.popover = [[UIPopoverController alloc] initWithContentViewController:imagePicker];
self.popover.delegate = self;
[self.popover presentPopoverFromBarButtonItem:self.openPhotosButton permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
这将有助于:

  • UIImagePickerControllerDelegate和imagePickerController:didFinishPickingMediaWithInfo:
  • UIPopoverControllerDelegate popoverControllerDidDismissPopover

您有两个的代理

UIImagePickerDelegate也是一个UINavigationControllerDelegate

您的类应实现UINavigationControllerDelegate,并包括以下内容:

 -(void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated {
     // [navigationController setNavigationBarHidden:YES];
      [[UIApplication sharedApplication] setStatusBarHidden:YES];  // This one works for me: OP
    }

我已经测试过了,它隐藏了导航栏。我不确定这样做是否与HIG冲突。

Oh-您是如何显示的-您能用如何显示的代码更新问题吗?你在做一些动画或smth?你在寻找像viewDidLoad或ViewDidDisplay这样的东西?(在实现UIViewController时覆盖的方法)。是的,但在本例中,popover的内容视图控制器是UIImagePickerController。我明白了。。。您无法覆盖UIImagePickerController,因此viewDidLoad方法无法工作。你想达到什么目标?可能还有另一种方法。我需要在显示UIImagePickerController时隐藏状态栏。(iOS 7相关)好的,明白了。ImagePickerDelegate也是一个UINavigationControllerDelegate,因此它包括-(void)navigationController:(UINavigationController*)navigationController willShowViewController:(UIViewController*)viewController animated:(BOOL)animated-在正确的时间调用。只要让你的类也实现UINavigationControllerDelegate。这个委托工作得很好。在显示ImagePickerView和录制任何相册时调用它。因此,它是隐藏状态栏的正确位置。谢谢。尝试了一些其他的解决方案,但都不太管用。这太完美了!