Here is how to programmatically set icon / image for Tab Bar Item in UITabBarViewController

Assumptions: I assume you have already embedded in UITabBarViewController for your ViewController in Interface Builder. I also assume you have three tab bar items with individual view controllers and further you have created images assets with your icon images.

Solution is simple you have to copy following code in your current View Controller’s ViewdidLoad method.


self.tabBarController?.tabBar.items?[0].image = UIImage(named: "Icon-1")
self.tabBarController?.tabBar.items?[1].image = UIImage(named: "Icon-2")
self.tabBarController?.tabBar.items?[2].image = UIImage(named: "Icon-3")

Hope it helps,

Thanks & Regards
Mandar Apte

Published by Mandar Apte

Mandar is a Mumbai-based multi-disciplinary designer with UX/UI, Logo, Symbol, and Brand Identity design expertise. He currently runs his Mudrkashar Linguistic Apple iPhone, iPad, and Mac app business in the heart of Mumbai city.

Leave a comment

Leave a Reply