gpt4 book ai didi

ios - 如何使用 Storyboard在 ios 的 Root View 中显示某些内容?

转载 作者:行者123 更新时间:2023-11-29 12:59:55 27 4
gpt4 key购买 nike

我正在使用 Storyboard在 ios 中创建一个应用程序。我有一个选项卡栏 Controller 作为我的 Root View ,从这个页面我可以使用选项卡导航到其他页面,但是我如何在选项卡栏 Controller 的 Root View 中插入任何文本或图像。

最佳答案

标签栏 Controller 的默认页面(或您所说的根页面)只是其他 UIViewController 之一。 UITabBarController 可以在其中显示另一个 UIViewControllerUITabBarController 中不能有文本或图像,但可以有一个包含文本或图像的 UIViewController。它只是其他 View Controller 的容器。

看看这个 example ,这将有助于简化事情。

FirstViewController *fistView = [[FirstViewController alloc] initWithNibName:@"FirstViewController" bundle:nil];
SecondViewController *secondView = [[SecondViewController alloc] initWithNibName:@"SecondViewController" bundle:nil];

NSArray *viewControllersArray = [[NSArray alloc] initWithObjects:fistView, secondView, nil];
self.tabController = [[UITabBarController alloc] init];
[self.tabController setViewControllers:viewControllersArray animated:YES];

在上面的代码中,firstView Controller 最初将显示在 tabController 中,因此您要做的是在 中添加文本和图像等内容firstView 的 xib 文件(或代码)。

关于ios - 如何使用 Storyboard在 ios 的 Root View 中显示某些内容?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20048170/

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