我已关注此Question 它适用于UITabBar项目文本,但如果我使用原始图像,那么我无法更改所选UITabBar项目图像的颜色
我正在改变图像色调并通过storyBoard使其成为原创而不是编程,即“selectedImageTintColor”(这是在选择模板图像而不是原件时更改tabbar项目图像颜色)
答案 0 :(得分:0)
function change_date_format($x){
return date('Y-m-d', $x/1000);
}
//User this line for selected Tabbar Image tint colour
UITabBar.appearance().tintColor = UIColor.purple
// You can set tab colours as per requirement here
// set red as selected background color
let numberOfItems = CGFloat(tabBar.items!.count)
let tabBarItemSize = CGSize(width: tabBar.frame.width / numberOfItems, height: tabBar.frame.height)
tabBar.selectionIndicatorImage = UIImage.imageWithColor(color: UIColor.red, size: tabBarItemSize).resizableImage(withCapInsets: UIEdgeInsets.zero)
// remove default border
tabBar.frame.size.width = self.view.frame.width + 4
tabBar.frame.origin.x = -2