When I click on tab bar item images their background (or whatever it is) width is increased. As you can see in the screenshot below image size is fixed but background width increases after I tap on any of them.
Does anyone know how to stop it happening?
Following is the code in my UITabBarController View
for tabBarItem in (self.tabBar.items)!{
tabBarItem.title = ""
tabBarItem.imageInsets = UIEdgeInsetsMake(6.0, 0.0, -6.0, 0.0)
let viewTabBar = tabBarItem.value(forKey: "view") as? UIView
let imgView = viewTabBar?.subviews[0] as? UIImageView
imgView?.frame.size.height = 32
imgView?.frame.size.width = 32
imgView?.clipsToBounds = true
imgView?.backgroundColor = .red
}