Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 476
Sayat Satybald Avatar asked Feb 12 '23 05:02

Sayat Satybald


2 Answers

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

like image 88
Sayat Satybald Avatar answered Feb 14 '23 19:02

Sayat Satybald


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

like image 24
srivas Avatar answered Feb 14 '23 19:02

srivas