I have an issue with UITabBarController
, the icons are changing size if I keep my finger on them and drag up or down, they are losing height by my dragging action, how can I stop that?
Here is my code:
override func viewWillAppear(_ animated: Bool) {
.................
vc_friends.tabBarItem.imageInsets = UIEdgeInsets(top: 6, left: 0, bottom: -5, right: 0)
vc_topCharts.tabBarItem.imageInsets = UIEdgeInsets(top: 6, left: 0, bottom: -5, right: 0)
vc_newsfeed.tabBarItem.imageInsets = UIEdgeInsets(top: 6, left: 0, bottom: -5, right: 0)
vc_myProfile.tabBarItem.imageInsets = UIEdgeInsets(top: 6, left: 0, bottom: -5, right: 0)
vc_pools.tabBarItem.imageInsets = UIEdgeInsets(top: 6, left: 0, bottom: -5, right: 0)
self.viewControllers = [vc_friends,vc_topCharts,vc_newsfeed,vc_pools,vc_myProfile]
self.selectedIndex = 2
}
This is how it looks like:
...and this if I click on it and keep my finger on it and move my finger up or down:
This is a known issue when your negative value is not the opposite of the positive value in the other direction. Change your insets to this:
UIEdgeInsets(top: 6, left: 0, bottom: -6, right: 0)