【发布时间】:2011-12-18 15:04:59
【问题描述】:
我希望我的splitviewController 显示在TabBarController 中。不幸的是,我首先决定只拥有一个SplitViewController 并选择了苹果的模板。现在我处于不方便的位置,不知道如何将其添加到标签栏。
我尝试了几个在 StackOverflow 上解释过的东西,但最好的结果是黑屏,下面有一个标签栏:-(
我只是在努力寻找一种既简单又好用的方法。
我的Appdelegate的代码:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Override point for customization after application launch.
// Add the split view controller's view to the window and display.
self.window.rootViewController = self.splitViewController;
[self.window makeKeyAndVisible];
NSArray *searchPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
documentFolderPath = [searchPaths objectAtIndex: 0];
self.rootViewController.directoryPath = documentFolderPath;
NSURL *docUrl = [launchOptions objectForKey:UIApplicationLaunchOptionsURLKey];
if ([docUrl isFileURL]) {
NSString *path = [docUrl path];
self.detailViewController.currentFilePath = path;
[self.detailViewController setDetails:path newFile:FALSE];
}
return YES;
【问题讨论】:
-
所以你想让你的 UITabBarController 的标签之一显示一个 UISplitViewController,里面有两个视图?
-
查看我的答案,您也可以使用 Interface Builder。
标签: objective-c ios ipad uitabbarcontroller uisplitviewcontroller