如何更改标签栏未选择的图标和文字的颜色?我找到了这个答案(如何更改标签栏上的非活动图标/文本颜色?),但无法为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) 我有一个应用程序UITabbar,我想在Tabbar中设置图像但我无法在Tabbar中设置图像.而不是因为它是图像我得到色彩的图像形状,是否可以像在Tabbar中设置图像?.
我已尝试此代码但无法设置图像.
UITabBar *tabBar = self.tabBar;
UITabBarItem *targetTabBarItem = [[tabbar items] objectAtIndex:0]; // whichever tab-item
UIImage *selectedIcon = [UIImage imageNamed:@"name-of-selected-image.png"];
[targetTabBarItem setSelectedImage:selectedIcon];
Run Code Online (Sandbox Code Playgroud)