iOS Tab Bar Icons Keep Getting Larger

iOS Tab Bar icons keep getting larger

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

Tab Bar icons too small despite being correct size

Image icons of 75x75 px should be fine for @3x devices.
If the title is nil, image will not expand on itself.

However you can shift the image using offset property.

Go to Size Inspector in storyBoard, and change image inset's Bottom offset.

Refer to this link for more info

Moving UITabBarItem Image down?

iOS7 Tabbar icons too big

Keep 60x60px icons but rename them as iconName@2x.png which iOS will automatically reduce to 30x30 points, roughly to half of the original size on retina devices.

If you are using assets catalogue, please make sure your icons are set to 2x icon sets.

Tab Bar Icon Size

You should not do this yourself system can do it automatically.

here is Apple Human Interface Guidelines, where you can find icon resolutions:
https://developer.apple.com/ios/human-interface-guidelines/icons-and-images/custom-icons/

for example:
If you are using circular icons for tab bar item you should create following sizes for portrait mode:

  • 75px × 75px (25pt × 25pt @3x)
  • 50px × 50px (25pt × 25pt @2x)
  • 25px × 25px (25pt × 25pt @1x)

and for landscape mode:

  • 54px × 54px (18pt × 18pt @3x)
  • 36px × 36px (18pt × 18pt @2x)
  • 18px × 18px (18pt × 18pt @1x)

after you add this icons into Assets.xcassets or somewhere, you can select Tab Bar Item icons from storyboard:

select Tab Bar item and in the attributes inspector, choose portrait image for image field, and landscape image for landscape field.

After that system will do everything for you.

Sample Image

TabBarItems and setting their image sizes?

You should prepare 3 images icons for each tab bar item (1x, 2x and 3x).

First create the 3x at 75w 75h pixels (maximum: 144 x 96) and save it as iconTab0@3x.png.

Then resize it to 50w 50h pixels (maximum: 96 x 64) and save it as iconTab0@2x.png.

Finally resize it to 25w 25h pixels (maximum: 48 x 32) and save it as iconTab0.png.

Now all you need is to select those 3 images at your finder and drag them to your image assets.

Human Interface Guidelines

Sample Image

Sample Image



Related Topics



Leave a reply



Submit