简体   繁体   English

iPhone - 从 UIWindow 启动 UIImagePickerController

[英]iPhone - launching an UIImagePickerController from a UIWindow

请问有什么可以发动UIImagePickerController从主的UIWindow从(无视图中定义) - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions ,上一个项目,其主窗口没有内置导航控制器到 IB(而不必在 IB 中添加一个)?

If you don't need UINavigationController then just place regular UIViewController as a root view for main windows.如果您不需要UINavigationController则只需将常规UIViewController作为主窗口的根视图。 And present UIImagePickerController from it.并从中呈现UIImagePickerController

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.那应该完成你想要的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM