将 iPad splitviewcontroller 添加到通用应用程序
当我的应用程序在 iPad 上启动时,我想使用完全不同的 xib,并且可能会为大多数内容使用不同的视图控制器。我的 iPhone 应用程序设置为使用 tabbarcontroller,但我希望该应用程序在 iPad 上使用 splitviewcontroller 启动。
这是代码,
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
NSLog(@"ipad");
self.window.rootViewController = self.splitViewController;
} else {
NSLog(@"iPhone");
self.window.rootViewController = self.tabBarController;
}
[self.window makeKeyAndVisible];
}
这对于 iPhone 运行良好,但当我在 iPad 上启动它时,日志显示。 2011-12-06 13:52:30.984 MA Mobile[38349:fe03] 应用程序预计在应用程序末尾有一个根视图控制器
我创建了一个与 mainwindow.xib 相同的单独笔尖,除了它有一个 splitviewcontroller它链接到应用程序委托而不是选项卡控制器。
更新已解决:未指定我的目标 iPad 主界面...
但是现在看来详细视图完全覆盖了整个视图(就像它不是分割视图,而只是没有导航控制器的表格视图)也许我错过了一些东西别的...
When my app starts on an iPad I want to use a totally different xib and will probably use different view controllers for most everything. My app for iPhone is setup to use a tabbarcontroller but I want the app to start with a splitviewcontroller when on iPad.
Here's the code
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
NSLog(@"ipad");
self.window.rootViewController = self.splitViewController;
} else {
NSLog(@"iPhone");
self.window.rootViewController = self.tabBarController;
}
[self.window makeKeyAndVisible];
}
This works fine for the iPhone but when I start it on an iPad the log says.
2011-12-06 13:52:30.984 MA Mobile[38349:fe03] Applications are expected to have a root view controller at the end of application
I have created a separate nib that is identical to the mainwindow.xib except it has a splitviewcontroller that is linked to the app delegate instead of a tabbarcontroller.
UPDATE SOLVED: My targets iPad Main Interface was not specified...
However it now appears that the detail view is totally covering the entire view (like it's not a split view but just a tableview with no navigation controller) maybe I'm missing something else...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论