ios设置tabbar背景颜色_IOS UITabBar 背景颜色及总结

像这种效果,网上有的例子是新建一个uiview设置好大小改好颜色然后addsubview,要么就是说要用自定义.. 试了N种还是解决不了!!  其实很简单,请看:

设置tabBar背景颜色

//swift

UITabBar.appearance().backgroundColor=UIColor(red:    76/255, green:76/255, blue:76/255, alpha:1)

UITabBar.appearance().backgroundImage=UIImage()

//oc

[[UITabBarappearance]setBackgroundImage:[[UIImagealloc]init]];

[[UITabBarappearance]setBackgroundColor:[UIColorwhiteColor]];

//swift

UITabBar.appearance().backgroundColor=UIColor(red:76/255, green:76/255, blue:76/255, alpha:1)

UITabBar.appearance().backgroundImage=UIImage()

//oc

[[UITabBarappearance]setBackgroundImage:[[UIImagealloc]init]];

[[UITabBarappearance]setBackgroundColor:[UIColorwhiteColor]];

设置选中颜色

UITabBar.appearance().tintColor=UIColor.greenColor()

图片转载自CYLTabBarController

IOS开发 经常会用到这种框架, 上边是Navigation, 下边是tabBar,又tabBar管理4个NavigationController,每个NavigationController又包含一个Controller去管理页面.

先说说思路,心急看颜色和坑的请快进到下边.

1.先建Controller然后每一个分别设为每个NavigationController的rootViewController.

2. 然后tabBarController有一个属性叫: viewControllers是个数组类型, 把navigation们都扔给他.

3. 创建好tabBarItem,别忘了xxNav.tabBarItem= xxItem或者xxController.tabBarItem= xxItem

思路大概是这样,具体可以看看CYLTabBarController的实现.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值