gpt4 book ai didi

iphone - 我想在同一 View Controller 中同时使用选项卡栏和导航栏

转载 作者:行者123 更新时间:2023-11-28 19:19:17 24 4
gpt4 key购买 nike

我从对象库中获取 ViewController 和 Put Navigation Controller,而不是将 Tab Bar Same As Navigation Controller....但是标签栏无法在 Controller 中显示...

最佳答案

首先在委托(delegate) .h 文件中声明标签栏 Controller

@property (strong, nonatomic) UITabBarController *tabBarController; 

然后声明您的 Root View Controller 并将其添加到 .m 文件中的导航 Controller

UIViewController *homeViewController = [[[HomeViewController alloc] initWithNibName:@"HomeViewController" bundle:nil] autorelease];
UINavigationController *navigationcontroller = [[[UINavigationController alloc] initWithRootViewController:homeViewController] autorelease];

然后将 Controller 数组添加到标签栏

self.tabBarController = [[[UITabBarController alloc] init] autorelease];
self.tabBarController.viewControllers = [NSArray arrayWithObjects:navigationcontroller,secondViewController and so on, nil];

关于iphone - 我想在同一 View Controller 中同时使用选项卡栏和导航栏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10229805/

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