问题描述
我将UIImagePickerController作为UIPopoverController的内容视图控制器。我需要检测弹出窗口刚刚完成呈现的时间(刚出现)。 UIPopoverController没有任何委托。我似乎无法找到一种方法来检测UIImagePickerController。 (适用于iPad)
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)
有任何建议吗?
// 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];
推荐答案
UIImagePickerDelegate也是UINavigationControllerDelegate。
The UIImagePickerDelegate is also a UINavigationControllerDelegate.
您的类应该实现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
}
我已经测试了这个和它隐藏导航栏。我不确定这样做是否与HIG发生冲突。
I've tested this and it hides the navigation bar. I am not sure if doing so conflicts with the HIG though.
这篇关于检测UIPopoverController何时完成呈现UIImageViewcontroller的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!