I am trying to implement an UITabBarController
with 2 UITabBarItems
. I added in storyboard the TabBarController. I almost did it, but still I am blocked with 2 important issues:
1) Here is how tab bar should look:
Please ignore orange button, that is not a tabItem.
So I put 2 tabItems , and I want to keep white images for both tabs even if one of them is selected.
I checked a lot of times with tintColor
, barTintColor
and no success.
Also I tried to set tabBarItem in ViewController:
override func awakeFromNib() {
super.awakeFromNib()
let imgHome = UIImage(named: "btnHome")?.imageWithRenderingMode(UIImageRenderingMode.AlwaysOriginal)
let imgProfile = UIImage(named: "btnProfile")?.imageWithRenderingMode(UIImageRenderingMode.AlwaysOriginal)
let imgSelectedTab = UIImage(named: "selectedTab_imgBackground")?.imageWithRenderingMode(UIImageRenderingMode.AlwaysOriginal)
tabBarItem = UITabBarItem(title: nil, image: imgProfile, selectedImage: imgSelectedTab)
}
but no success. Any thoughts at this issue ?
2) Second issue is about selectedImage
property of UITabBarItem
class.
The width
of image does not fit the tab. I changed between devices, and for every device the selected image is over the other tab, or does not fit the current tab.(I found a solution: to have the same image but with different width for every device. But for sure this is not a good solution)
Any kind of help will be fine! Many thanks