ios设置tabbar背景颜色_iOS Tabbar的一些设置(背景颜色、点击设置)

这篇博客主要介绍了如何在iOS中自定义TabBar的背景颜色、标题文字颜色以及选中状态的颜色。同时,还详细讲解了消除TabBar边框的方法以及设置TabBar Item的原始图标和选中图标,确保图标不被系统自动填充颜色。
摘要由CSDN通过智能技术生成

设置底部标题点击时的颜色

[[UITabBarItem appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor whiteColor],NSForegroundColorAttributeName,nil] forState:UIControlStateNormal];

UIColor *titleHighlightedColor = [UIColor whiteColor];

[[UITabBarItem appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:titleHighlightedColor, NSForegroundColorAttributeName,nil] forState:UIControlStateSelected];

设置tabbar选中颜色

iOS7设置如下:

[self.tabBarController.tabBarsetSelectedImageTintColor:[UIColor greenColor]];

ios8中如下设置:

self.tabBar.tintColor=[UIColor greenColor];

消除tabbar边框

在appdelegate的程序启动处:

[[UITabBar appearance] setShadowImage:[[UIImage alloc]init]];

[[UITabBar appearance] setBackgroundImage:[[UIImage alloc]init]];

设置tabbar item原始图标与原始选中图标,而不是系统自动填充的颜色

// 拿到 TabBar 在

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值