longbow
longbow

Reputation: 1623

iOS8/Swift: Tab Bar Item getting smaller on click

I just encountered a weird bug when giving insets to my Tab Bar images.

When I click the image in the built version, the image will apply the inset every time i click it -> so if you click it 3x it will basically disappear - if you click another Tab Bar Item it reappears again.

Obviously this only happens if you set left/right inset - not if you only set top/bottom

Anyone knows how to fix this without resizing the actual Tab Bar Image externally?

Upvotes: 22

Views: 3924

Answers (1)

Y0gita
Y0gita

Reputation: 531

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)

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

Upvotes: 52

Related Questions