Martin Perry
Martin Perry

Reputation: 9527

UITabBarItem and icon size

I am using UITabBarItem. If i set image, its not correctly displayed. Image is "zoomed", so I can see only top part of it. Image size is 60x60px.

I am setting image from xcodes XIB editor -> BarItem -> Image

Whats wrong with it ? According to Apple Doc, image should be 60x60 for Retina and even bigger images should be auto-scaled to fit viewing area.

Upvotes: 2

Views: 9896

Answers (2)

Maciej Trybiło
Maciej Trybiło

Reputation: 1207

When you are supplying a retina image you should name it with [name]@2x~iphone.png or [name]@2x~ipad.png. Then, in the IB you should put the name of the file without the whole suffix, so just [name] instead of [name]@2x~iphone.png. The image won't show up in the IB, but should be ok in the live app.

Upvotes: 9

Maen
Maen

Reputation: 10698

First, you have to make two icons, one of 30x30, and a second one 60x60 with "@2x" appended at the end of your filename.

Then bind the 30x30 icon to your UITabBarItem in XIB editor. Apple should select automatically the appropriate picture to display depending on the device it's running on.

Upvotes: 9

Related Questions