Ofri
Ofri

Reputation: 289

UITabBar buttons' images wrong size

I have a UITabBarController.

I added images to the bar buttons. On the ViewController the image size is fine, but on the TabBarController it looks all messed up.

Furthermore, when I fire up the app, and click the tabs - the images change size. I read online that I need to set the inset to be, for example:

Top: 5, Bottom: -5

But then the image isn't the size I want it to be, and it overlaps the text I want it to also have.

See image please.

How do I fix that? I am using Swift.

My Storyboard

Upvotes: 0

Views: 1684

Answers (2)

Suhit Patil
Suhit Patil

Reputation: 12023

As per Apple Human Interface Guidelines, Tab Bar Icon size varies for different size glyphs and for portage and landscape mode, refer the guide below and check if the icon size is matching the size given. Make sure to verify @2x and @3x image icon sizes and add them if missing the proper size.

Tab bar Icon Size Chart

Upvotes: 0

Ilya Kharabet
Ilya Kharabet

Reputation: 4621

You should set images with correct size - 32x32, because UITabBarController does not fit images automatically.

For resizing images you can use something like this: https://github.com/ymedialabs/UIImageCategories/blob/master/UIImage%2BvImage.swift

Upvotes: 0

Related Questions