IOS tab icons blurred

The icons on the tab appear blurry.

enter image description here

I created the icons using Photoshop and followed the iOS Human Interface Guidelines when I decided the size of each icon.

eg. Icon Size: 30x30px png

This only happens with the tab bar. I wonder if this is due to image resolution or due to programming problems ...

+6
source share
4 answers

You are using the icon size of 30x30 , which I assume for 1x (iPhone <4). Since iPhone> = 4 needs 2x and 3x images, so you should also enable this.

Or you use images with naming conventions like

 star.png // 1x = 30x30 star@2x.png // 2x = 60x60 star@3x.png // 3x = 90x90 

or you can use image.xcassets and put there 1x , 2x and 3x images and use it.

Xcode Asset Directories Link

+11
source

Perhaps this is due to the use of a device with a retina screen.

Try changing the icon file name to xxx@2x.xxx , for example, " facebook_icon@2x.png ".

+1
source

Also, be careful, you can use a PDF file (resolution-independent vector graphics) instead of PNG, and Xcode will give you the appropriate permissions at build time (I don't think you can easily do this for third-party icons like Facebook, but...).

To learn how to do this, create a new project using the Tabbed Application template and check the asset catalog for the icon images in the tab. It does this only for the round and square icons of the initial tabs "First" and "Second".

+1
source

Use this line of code to set the image for uitabbaritem in uitabbar.

 tabbaritem.image = [[UIImage imageNamed:@"image"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]; 
0
source

All Articles