Poo*_*kie 2 uitabbaritem uitabbar swift
我试图更改未选中的UITabBarItems的默认灰色.我设法改变了文本而不是图像.

TabBar.appearance().barTintColor = UIColor(red: 86.0/255.0, green: 132.0/255.0, blue: 208.0/255.0, alpha: 1.0)
var normalTint: UIColor = UIColor.whiteColor()
TabBar.appearance().tintColor = UIColor.whiteColor()
UITabBarItem.appearance().setTitleTextAttributes([NSForegroundColorAttributeName: normalTint,NSFontAttributeName: UIFont(name: "Arial", size: 13)!], forState: UIControlState.Normal)
Run Code Online (Sandbox Code Playgroud)
Der*_*ike 13
iOS 10 | 斯威夫特3
class TabBarVC: UITabBarController {
override func viewDidLoad() {
super.viewDidLoad()
// make unselected icons white
self.tabBar.unselectedItemTintColor = UIColor.white
}
}
Run Code Online (Sandbox Code Playgroud)
您可以使用 .AlwaysOriginal
tabBarItem.selectedImage = UIImage(named: "first-selected")!.imageWithRenderingMode(.AlwaysOriginal)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4180 次 |
| 最近记录: |