您的位置:首页 > 移动开发 > Swift

Swift tabbar样式设置

2016-12-20 15:33 267 查看
UITableBarController是经常使用的

tabbar的背景颜色默认是半透明的好像

swift2.x

        UITabBar.appearance().translucent =
false; //避免受默认的半透明色影响,关闭
        UITabBar.appearance().barTintColor =
UIColor.whiteColor()//设置背景颜色
        UITabBar.appearance().tintColor =
UIColor.yellowColor()//设置选中的背景颜色
        UITabBar.appearance().clipsToBounds =
true;//去掉上面的分割线

注意:网上有下面这种设置背景颜色的方式。我试了,貌似没效果,不知道为什么。还是用上面的方式吧
 UITabBar.appearance().backgroundColor =UIColor(red: 255/255,
green:0/255, blue:0/255, alpha:1)//设置为红色,不透明
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: