TabBarController和SplitViewController [英] TabBarController and SplitViewController

查看:164
本文介绍了TabBarController和SplitViewController的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望我的 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).

看看在 http://www.codeworth.com/blog/mobile/ios -splitviewcontroller-inside-tabviewcontroller /

我认为这是问题的恰当答案。

I think this would be the apt answer for the question.

这篇关于TabBarController和SplitViewController的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆