iPhone - launching an UIImagePickerController from a UIWindow
How may I launch a UIImagePickerController from the main UIWindow (no view defined) from - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions, on a proj开发者_StackOverflowect for which the main window does not have a built-in Navigation controller into IB (and without having to add one into IB)?
If you don't need UINavigationController then just place regular UIViewController as a root view for main windows. And present UIImagePickerController from it.
Example:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window.rootViewController = [[[UIViewController alloc] init] autorelease];
UIImagePickerController *imagePickerController = [[[UIImagePickerController alloc] init] autorelease];
[self.window.rootViewController presentModalViewController:imagePickerController animated:YES];
[self.window makeKeyAndVisible];
return YES;
}
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
[window addSubview:imagePickerController.view];
That should accomplish what you want.
加载中,请稍侯......
精彩评论