问题描述
我希望我的 splitviewController
显示在 TabBarController
中。不幸的是,我首先决定只有一个 SplitViewController
并选择了apple的模板。现在我处于不方便的位置,不知道如何将它添加到标签栏。
i want my splitviewController
to be displayed in within a TabBarController
. Unfortunately, I firstly decided to just have a SplitViewController
and chose apple's template. Now i am in the inconvenient position not knowing how to add it to a tab bar.
我尝试了几个在StackOverflow上解释的东西,但最好的结果是黑色屏幕下面有一个标签栏: - (
I tried several stuff that was explained here on StackOverflow but the best result was a black screen with a tab bar below it :-(
我正在努力找到一个简单明了的方法。
I am just struggling to find a nice and simple way.
我的代码
的代码:
- (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;
推荐答案
从Apple的文档中可以看出这是不可取的。
From Apple's documentation this is a no no situation.
但有一种方法可以轻松实现这一目标(我们为应用程序做到了这一点)。
But there is a way to achieve this easily (we did it for an application).
看看在
我认为这是问题的恰当答案。
I think this would be the apt answer for the question.
这篇关于TabBarController和SplitViewController的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!