I need to load tabbar items. Here i need different background colors for tabbar in different tabs . i am changing bar tint color in didSelectItem. But it's background color is not changing . while loading tab bar it is working fine .
Here is my code
override func viewDidLoad() {
if(tabIndex == 1){
UITabBar.appearance().tintColor = UIColor.whiteColor()
UITabBar.appearance().barTintColor = Colors.TAB_BAR_ALBUM_BG_COLOR
self.view.backgroundColor = Colors.TAB_BAR_ALBUM_BG_COLOR
}else if(tabIndex == 2){
UITabBar.appearance().tintColor = UIColor.whiteColor()
UITabBar.appearance().barTintColor = Colors.TAB_BAR_ME_BG_COLOR
self.view.backgroundColor = Colors.TAB_BAR_ME_BG_COLOR
}
}
While loading tabbar tint color is loading fine
override func tabBar(tabBar: UITabBar, didSelectItem item: UITabBarItem!) {
UITabBar.appearance().tintColor = UIColor.whiteColor()
if(item.tag == 1){
UITabBar.appearance().barTintColor = Colors.TAB_BAR_ALBUM_BG_COLOR
self.view.backgroundColor = Colors.TAB_BAR_ALBUM_BG_COLOR
}else if(item.tag == 2){
UITabBar.appearance().barTintColor = Colors.TAB_BAR_ME_BG_COLOR
self.view.backgroundColor = Colors.TAB_BAR_ME_BG_COLOR
}
}
While changing tabbar items it's not working .