gpt4 book ai didi

iphone - 如何将选项卡栏 Controller 添加到 Split View Controller 应用程序的 Root View

转载 作者:搜寻专家 更新时间:2023-10-30 20:06:35 27 4
gpt4 key购买 nike

enter image description here

我对 iPad UISplitViewController 很陌生。

我需要在主视图/左 View 的底部添加一个包含 3 个选项卡的选项卡栏。对于 3 个选项卡中的每一个,我都有一个不同的 View Controller 。我还没有找到在基于 Split View的应用程序中使用 Tab 栏的任何其他示例。

我在哪里插入一个标签栏 Controller 来显示在 Root View 的底部?

如何建立连接,以便在我选择表格单元格时,detailItem 信息显示在详细信息 View 中?选项卡栏已添加到 IB 中的 Root View 。我应该改为以编程方式添加它吗?

最佳答案

在您的应用委托(delegate)中添加标签栏 Controller ,然后将您的 View Controller 添加到标签栏 Controller 并将窗口 Root View Controller 设置为标签栏 Controller 。

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
self.tabbar=[[UITabBarController alloc] init];

self.vc1 = [[vc1 alloc] initWithNibName:@"ViewController_iPhone" bundle:nil];
// do the same to other VCs
self.tabbar.viewControllers=[NSArray arrayWithObjects:vc1,vc2,vc3,vc4, nil];


self.window.rootViewController = self.tabbar;

[self.window makeKeyAndVisible];
return YES;

希望对您有所帮助:-)

关于iphone - 如何将选项卡栏 Controller 添加到 Split View Controller 应用程序的 Root View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10493711/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com