ios中淘宝底部导航栏的制作

本文介绍如何使用 iOS UIKit 框架中的 TabBarController 和 UINavigationController 创建带有多页面的导航界面,并展示了如何设置各页面的标题及图片等关键配置。
    //创建第一个页面控制器
    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;
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值