gpt4 book ai didi

ios - 标签栏未与UITabBarController一起出现

转载 作者:行者123 更新时间:2023-12-01 16:31:53 25 4
gpt4 key购买 nike

我对此代码有疑问:
http://pastebin.com/4D6hmAQh

标题栏成功显示(带有标题aFaire),但未出现选项卡栏。

如何以编程方式使标签栏出现?

最佳答案

您已经覆盖了loadViewRootViewController方法,并且没有调用[super loadView]语句。但是,UITabBarController需要通过tabBar方法初始化其loadView。因此,您必须调用[super loadView]

- (void)loadView {
[super loadView];
// self.view = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]];

self.title = @"aFaire";

NSMutableArray *localViewControllersArray = [[NSMutableArray alloc] initWithCapacity:3];
FirstViewController *firstViewController = [[FirstViewController alloc] initWithNibName:@"FirstViewController" bundle:nil];
firstViewController.tabBarItem.title = @"First";

[localViewControllersArray addObject:firstViewController];

self.viewControllers = localViewControllersArray;
self.view.autoresizingMask = (UIViewAutoresizingFlexibleHeight);
}

关于ios - 标签栏未与UITabBarController一起出现,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31258445/

25 4 0