Sayat Satybald
Sayat Satybald

Reputation: 6580

Tab Bar Item Image Does Not Show Up

I'm trying to assign a custom image to UITabBarItem in storyboard. Unfortunately, it shows me an box instead of an image.

Here's my PNG image enter image description here

Storyboard: enter image description here

How it appear in simulator: enter image description here

Upvotes: 4

Views: 7125

Answers (2)

srivas
srivas

Reputation: 319

Go to Assets folder. Select your tab image. On the right side under Attributes you will find "Render As". Select "Original Image".

Upvotes: 2

Sayat Satybald
Sayat Satybald

Reputation: 6580

As it turned out in order do display an actual image following code should be executed.

[self.activityItem setImage:[[UIImage imageNamed:@"activity.png"] 
    imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];

Note the Rendering Mode of UIImage. You can find more about it UITabBar Reference Thanks to @ Vladislav Kovalyov

Upvotes: 6

Related Questions