我有一个使用故事板的项目。最初的 ViewController 是一个 UITabBarController,它承载了两个 ViewController,其中第一个是 UIImagePickerController。
我应该在哪里配置 UIImagePickerController(设置它的 sourceType 等)?
我有一个使用故事板的项目。最初的 ViewController 是一个 UITabBarController,它承载了两个 ViewController,其中第一个是 UIImagePickerController。
我应该在哪里配置 UIImagePickerController(设置它的 sourceType 等)?
在应用程序委托中怎么样?
- (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;
}