【发布时间】:2015-01-28 17:00:31
【问题描述】:
我正在尝试自定义我的UITabBarController。我将它嵌入到我的UIViewController 中,我还为此UITabBarController 创建了一个类。
override func viewDidLoad() {
super.viewDidLoad()
//custom tab bar
self.tabBar.barTintColor = UIColor(red: 0.0/255.0, green: 102.0/255.0, blue: 153.0/255.0, alpha: 1)
self.tabBar.tintColor = UIColor(red: 171.0/255.0, green: 203.0/255.0, blue: 61.0/255.0, alpha: 1)
self.tabBarItem.setTitleTextAttributes([NSForegroundColorAttributeName: UIColor.whiteColor()], forState:UIControlState.Normal)
self.tabBarItem.setTitleTextAttributes([NSForegroundColorAttributeName: UIColor.whiteColor()], forState:UIControlState.Disabled)
for item in self.tabBar.items as [UITabBarItem]
{
item.image = item.selectedImage.imageWithRenderingMode(UIImageRenderingMode.AlwaysOriginal)
}
// Do any additional setup after loading the view.
}
setTitleTextAttributes 对标签栏项目没有任何影响。有人可以帮我找出错误在哪里吗?
【问题讨论】:
标签: ios swift uitabbaritem