Ios 我可以为UIImagePickerController使用现有的Popover吗?

Ios 我可以为UIImagePickerController使用现有的Popover吗?,ios,swift,ios8,uipopovercontroller,Ios,Swift,Ios8,Uipopovercontroller,我是否可以将现有UIPopoverController与UINavigationController一起使用以显示UIImagePickerController 我尝试了很多,但是打开UIImagePickerController的唯一方法是关闭现有的Popover并打开一个新的。但我想使用现有的UINavigationController 我的iPad应用程序中有一些具有不同操作的按钮(在popover中)——如果用户选择“图像”,则会有另一个带有“来自现有图像”或“来自照相机”的视图控制器—

我是否可以将现有UIPopoverController与UINavigationController一起使用以显示UIImagePickerController

我尝试了很多,但是打开UIImagePickerController的唯一方法是关闭现有的Popover并打开一个新的。但我想使用现有的UINavigationController

我的iPad应用程序中有一些具有不同操作的按钮(在popover中)——如果用户选择“图像”,则会有另一个带有“来自现有图像”或“来自照相机”的视图控制器——如果我使用“现有图像”,我想在现有popover控制器中打开照片库(因为当用户选择一个图像时,我希望转到UINavigationController中的下一个ViewController)

Atm我在这里打开我的popover:

var popoverAddItems = UIStoryboard(name: "Main", bundle: nil).instantiateViewControllerWithIdentifier("popoverAddItems") as PopoverAddItemsViewController
var navigationPopover:UINavigationController!
var popover:UIPopoverController!

好的,现在我在我的popoverAddItems ViewController上,但是我如何才能在这个UINavigationController中添加照片库

因此,我可以在关闭现有Popover时使用它:

var imagePickerViewController = PopoverImagePickerViewController()
imagePickerViewController.modalPresentationStyle = UIModalPresentationStyle.Popover
popover = UIPopoverController(contentViewController: imagePickerViewController)
popover.popoverContentSize = CGSizeMake(320,120)
popover.presentPopoverFromRect(currentCell.LabelCellTitle.frame, inView: currentCell.LabelCellTitle.superview!, permittedArrowDirections: UIPopoverArrowDirection.Left, animated: true)

有什么想法吗?若要在您的popover中显示UIImagePickerController(在您的情况下,它是UIPopopOvercontroller中的UINavigationController),请在“showImagePicker:”例程中使用以下代码,我们将不胜感激

    UIImagePickerController* imagePickerController = [[UIImagePickerController alloc] init];
    imagePickerController.delegate = self;
    imagePickerController.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;  // Use your type here
    imagePickerController.modalInPopover = YES;
    imagePickerController.modalPresentationStyle = UIModalPresentationCurrentContext;

    [self.navigationController presentViewController:imagePickerController animated:YES completion:NULL];
从UINavigationControllers viewController层次结构内部调用此项时,一切正常。如果从其他地方调用,请确保使用UIPopoverController中使用的UINavigationController项来显示UIImagePickerController

    UIImagePickerController* imagePickerController = [[UIImagePickerController alloc] init];
    imagePickerController.delegate = self;
    imagePickerController.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;  // Use your type here
    imagePickerController.modalInPopover = YES;
    imagePickerController.modalPresentationStyle = UIModalPresentationCurrentContext;

    [self.navigationController presentViewController:imagePickerController animated:YES completion:NULL];