问题
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