我正在开发一个 iPhone 应用程序,使用 UITabBar 来开发它。 tabbar 中只有第二个 tabbar 标题可见,但第一个 tabbar 标题不显示在 tabbar 中,如何解决?请帮我, 提前致谢。
下面是供您引用的源代码。
NSMutableArray *items = [[NSMutableArray alloc]init];
tab =[[UITabBar alloc]initWithFrame:CGRectMake(0, 300, 320, 44)];
[self.tabBarItem initWithTitle:@"sample1" image:nil tag:111];
[items addObject:self.tabBarItem];
[self.tabBarItem initWithTitle:@"sample2" image:nil tag:101];
[items addObject:self.tabBarItem];
[tab setItems:items animated:YES];
[self.view addSubview:tab];
最佳答案
不要导航 View Controller ,否则包含 TabBar 的 Controller 将被弹出。
当我们使用 UITabBar 时,我们不会以这种方式使用导航。
只需添加带有此类框架的新 Controller ,以便您的 TabBar 始终可见。
关于iphone - 如何在 iPhone 中设置 Tabbar 集成?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12401993/