I am having a problem with my icons in my tabBar
.
我的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?
任何想法我应该解决什么?
3 个解决方案
#1
46
As per the project shared by the OP (see question comments), it seems the tab bar image insets seem to be messing things up.
根据OP共享的项目(参见问题评论),似乎标签栏图像插图似乎搞乱了。
Steps to resolve the issue:
- Select the tab bar item of the problematic
ViewController
s in IB - 在IB中选择有问题的ViewControllers的选项卡栏项
- Go to Size Inspector section (on the right)
- 转到“大小检查器”部分(右侧)
- Ensure your image insets are balanced
- If you give 5px inset to top then balance with a -5px inset to bottom
- 如果你将5px插图置于顶部,则以-5px插入到底部进行平衡
- If you give 5px inset to left then balance with a -5px inset to right
- 如果你给左边5px插图然后平衡右边的-5px插图
- 确保你的图像插入是平衡的如果你给5px插入到顶部然后平衡-5px插入到底部如果你给5px插入到左边然后平衡-5px插入到右边
I have no explanation for this, sorry... but if anyone does then kindly comment/post
我对此没有任何解释,抱歉......但如果有人这么做,那么请发表评论/发帖
#2
1
try This..
尝试这个..
myDealNavigationController.tabBarItem.imageInsets = UIEdgeInsetsMake(5, 0, -5, 0);
myDealNavigationController.tabBarItem.imageInsets = UIEdgeInsetsMake(5,0,-5,0);
#3
0
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.
它将使UI适当。
Thanks
谢谢
#1
46
As per the project shared by the OP (see question comments), it seems the tab bar image insets seem to be messing things up.
根据OP共享的项目(参见问题评论),似乎标签栏图像插图似乎搞乱了。
Steps to resolve the issue:
- Select the tab bar item of the problematic
ViewController
s in IB - 在IB中选择有问题的ViewControllers的选项卡栏项
- Go to Size Inspector section (on the right)
- 转到“大小检查器”部分(右侧)
- Ensure your image insets are balanced
- If you give 5px inset to top then balance with a -5px inset to bottom
- 如果你将5px插图置于顶部,则以-5px插入到底部进行平衡
- If you give 5px inset to left then balance with a -5px inset to right
- 如果你给左边5px插图然后平衡右边的-5px插图
- 确保你的图像插入是平衡的如果你给5px插入到顶部然后平衡-5px插入到底部如果你给5px插入到左边然后平衡-5px插入到右边
I have no explanation for this, sorry... but if anyone does then kindly comment/post
我对此没有任何解释,抱歉......但如果有人这么做,那么请发表评论/发帖
#2
1
try This..
尝试这个..
myDealNavigationController.tabBarItem.imageInsets = UIEdgeInsetsMake(5, 0, -5, 0);
myDealNavigationController.tabBarItem.imageInsets = UIEdgeInsetsMake(5,0,-5,0);
#3
0
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.
它将使UI适当。
Thanks
谢谢