Reputation: 11
I can't see the tabbar
images when i simulate my app.
I tried changing the "render as original image" solution, but it didn't work
import UIKit
class TabBarController: UITabBarController {
override func viewDidLoad() {
super.viewDidLoad()
setupTabBar()
tabBar.barTintColor = UIColor(red: 0.1255, green: 0.1608, blue: 0.149, alpha: 1)
}
func setupTabBar() {
let homeController = UINavigationController(rootViewController: HomeViewController())
homeController.tabBarItem.image = UIImage(named: "homeglyph_green")
homeController.tabBarItem.selectedImage = UIImage(named: "homeglyph_lightgreen")
let statsController = UINavigationController(rootViewController: StatsViewController())
statsController.tabBarItem.image = UIImage(named: "statsglyph_green")
statsController.tabBarItem.selectedImage = UIImage(named: "statsglyph_lightgreen")
viewControllers = [homeController, statsController]
guard let items = tabBar.items else { return }
for item in items {
item.imageInsets = UIEdgeInsets(top: 4, left: 0, bottom: -4, right: 0)
}
}
}
Upvotes: 1
Views: 60
Reputation: 310
Make sure Your Image name is same as your store name in Image assets..
if name is same then open Image assets..
1)select Your Image
2) go on Image set
3) change Render As option default to Template Image and run project..
hope fully help this solution..
image-You can find where you should change
Upvotes: 1