iOS Tab Bar icons keep getting larger

让人想犯罪 __ 提交于 2019-12-17 15:49:10

问题


I am having a problem with my icons in my tabBar.

Tapping the same tab bar button repeatedly will keep increasing the tab bar icon's size.
If I push a different one, it goes back to its original size.

Any ideas what I should fix?


回答1:


As per the project shared by the OP (see question comments), it seems the tab bar image insets seem to be messing things up.


Steps to resolve the issue:

  1. Select the tab bar item of the problematic ViewControllers in IB
  2. Go to Size Inspector section (on the right)
  3. Ensure your image insets are balanced
    • If you give 5px inset to top then balance with a -5px inset to bottom
    • If you give 5px inset to left then balance with a -5px inset to right

I have no explanation for this, sorry... but if anyone does then kindly comment/post




回答2:


try This..

myDealNavigationController.tabBarItem.imageInsets = UIEdgeInsetsMake(5, 0, -5, 0);




回答3:


I was also running with same issue and above accepted answer helped me.

Just to show case what steps to do:

While setting image to tab bar select image and balance image insets from all sides.

Need to keep few things in mind:

As shown in below image, balance from all four sides.

It will make UI proper.

Thanks



来源:https://stackoverflow.com/questions/23306963/ios-tab-bar-icons-keep-getting-larger

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!