【问题标题】:Configuring a UIImagePickerController in a UITabBarController in a UIStoryboard在 UIStoryboard 的 UITabBarController 中配置 UIImagePickerController
【发布时间】:2012-01-31 02:42:47
【问题描述】:

我有一个使用故事板的项目。最初的 ViewController 是一个 UITabBarController,它承载了两个 ViewController,其中第一个是 UIImagePickerController。

我应该在哪里配置 UIImagePickerController(设置它的 sourceType 等)?

【问题讨论】:

    标签: iphone ios5 uitabbarcontroller uiimagepickercontroller uistoryboard


    【解决方案1】:

    在应用委托中怎么样?

    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    {
        // Override point for customization after application launch.
    
        UITabBarController *tabBarController = (UITabBarController *)[self.window rootViewController];
    
        // Per OP, first view controller in the tab bar is the UIImagePickerController.
        UIImagePickerController *imagePicker = [tabBarController.viewControllers objectAtIndex:0];
    
        // Your configuration code here: 
        // imagePicker.sourceType = <your code here>
    
        return YES;
    }
    

    【讨论】:

    • OP 说图像选择器控制器在标签栏控制器中。
    • 已验证解决方案有效。 tabBarController 是可用的。
    猜你喜欢
    • 2012-04-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-09-29
    • 1970-01-01
    • 1970-01-01
    • 2011-05-25
    • 1970-01-01
    相关资源
    最近更新 更多