iPhone - 从 UIWindow 启动 UIImagePickerController

标签 iphone ios uinavigationcontroller uiimagepickercontroller uiwindow

我如何启动 UIImagePickerController来自 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 的主 UIWindow(未定义 View ) ,在主窗口没有内置导航 Controller 进入 IB 的项目上(并且无需向 IB 添加导航 Controller )?

最佳答案

如果您不需要 UINavigationController,那么只需将常规 UIViewController 作为主窗口的 Root View 即可。并从中呈现 UIImagePickerController

示例:

- (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;
}

关于iPhone - 从 UIWindow 启动 UIImagePickerController,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7616217/

相关文章:

iOS 应用程序库目录 <uid> 总是会更改

iphone - 创建具有透明背景色的图层

ios - 自定义 'add' View 动画到 uistackview

ios - 检测是否按下导航栏中的默认后退按钮

ios - 删除中间 View 时自动布局折叠空间

iphone - Three20 - 将 TTTableViewController 设置为 TableBannerView 时获得空的 TableView

ios - 标签栏 Controller 需要点击2次返回主视图

ios - 异步图像设置为具有动态高度错误的单元格

ios - 在 StoryBoard 的 TabController 内部使用 Navigation。

ios - 单击按钮时隐藏 TabBar 并显示 NavigationController 工具栏