Ios 如何从选项卡栏项显示UIImagePickerController

Ios 如何从选项卡栏项显示UIImagePickerController,ios,objective-c,swift,uitabbarcontroller,uitabbaritem,Ios,Objective C,Swift,Uitabbarcontroller,Uitabbaritem,我有一个UITabViewController。我试图在选择特定的选项卡栏项时以模式显示UIImagePickerController。它必须出现在当前UIViewController上。这就像在Instagram或潜望镜应用程序中按下相机图标时发生的情况。但是,如果不显示连接到选项卡栏项的UIViewController,我无法理解如何显示UIImagePickerController。这可能吗 谢谢 Yusuf您可以使用UITabBarControllerDelegate的shouldSel

我有一个UITabViewController。我试图在选择特定的选项卡栏项时以模式显示UIImagePickerController。它必须出现在当前UIViewController上。这就像在Instagram或潜望镜应用程序中按下相机图标时发生的情况。但是,如果不显示连接到选项卡栏项的UIViewController,我无法理解如何显示UIImagePickerController。这可能吗

谢谢


Yusuf

您可以使用
UITabBarControllerDelegate
shouldSelectViewController
方法来完成类似的操作

- (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController {
    // Check if it's the "image picker" tab
    if (viewController == self.imagePickerTabView) {
        // Present image picker
        return NO;
    }

    // All other cases switch to the tab
    return YES;
}