//创建第一个页面控制器
FirstViewController *first=[[FirstViewController alloc] init];
//创建第一个页面导航控制器
UINavigationController *firstNav=[[UINavigationController alloc]initWithRootViewController:first];
//设置第一个标题
firstNav.tabBarItem.title=@"首页";
//设置未选中的图片
firstNav.tabBarItem.image=[UIImage imageNamed:@""];
//设置已选中的图片
firstNav.tabBarItem.selectedImage=[UIImage imageNamed:@""];
//统一设置导航控制器的样式
[[UINavigationBar appearance]setBarTintColor:[UIColor greenColor]];
[[UINavigationBar appearance]setTranslucent:NO];
//创建第二个页面控制器
SecondViewController *second=[[SecondViewController alloc] init];
//创建第二个页面导航控制器
UINavigationController *secondNav=[[UINavigationController alloc] initWithRootViewController:second];
//设置第二个标题
secondNav.tabBarItem.title=@"淘宝";
//将页面放在tabbar中
UITabBarController *tabController=[[UITabBarController alloc] init];
tabController.viewControllers=[NSArray arrayWithObjects:firstNav,secondNav,nil];
//将tabbar作为window根视图
self.window.rootViewController=tabController;
ios中淘宝底部导航栏的制作
最新推荐文章于 2024-05-05 23:30:04 发布
本文介绍如何使用 iOS UIKit 框架中的 TabBarController 和 UINavigationController 创建带有多页面的导航界面,并展示了如何设置各页面的标题及图片等关键配置。
2万+

被折叠的 条评论
为什么被折叠?



