detect when UIPopoverController has finished presented UIImageViewcontroller

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-11 09:57:06

问题


I have the UIImagePickerController as a content View Controller for the UIPopoverController. I need to detect when the popover has just finished presented (has just showed up). UIPopoverController does not have any delegate for this. I can't seem to find a way to detect the UIImagePickerController as well. (This is for iPad)

Any suggestions?

// 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];

回答1:


The UIImagePickerDelegate is also a UINavigationControllerDelegate.

Your class should implement UINavigationControllerDelegate and include the following:

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

I've tested this and it hides the navigation bar. I am not sure if doing so conflicts with the HIG though.




回答2:


Thise should help:

  • UIImagePickerControllerDelegate and imagePickerController:didFinishPickingMediaWithInfo:
  • UIPopoverControllerDelegate popoverControllerDidDismissPopover

You have delegates for both



来源:https://stackoverflow.com/questions/18831764/detect-when-uipopovercontroller-has-finished-presented-uiimageviewcontroller

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!