Denis Kutlubaev
Denis Kutlubaev

Reputation: 16204

TabBarImage is not resized properly

I am trying to assign a 60x60 px image to the tabBarItem.image:

self.tabBarItem.image = [UIImage imageNamed:@"[email protected]"];

I have read in HIG, that I should put 60x60 px image for the Retina display. But what I get is an incorrectly sized image:

enter image description here

If I make it 30x30px ,it looks bad too (not like for Retina).

Upvotes: 1

Views: 1069

Answers (1)

Nate
Nate

Reputation: 31045

You don't need to specify that the @2x.png image is used. For your project, just add these two images in Xcode:

[email protected] (60x60 pixels)

tab_settings.png (30x30 pixels)

And then in your code use this:

self.tabBarItem.image = [UIImage imageNamed:@"tab_settings"];

iOS will determine whether to use the 30x30, or 60x60 image for you. It's a really nice design by Apple.

Upvotes: 5

Related Questions