iOS tab bar icons are blurry - ios

My tab bar icons appear blurry.
I created the icons using Photoshop, and followed the iOS Human Interface Guidelines when I decided the sizes of each icons.
e.g. icon size: 30x30px png
This only happens with the tab bar. I wonder if this happens because of the resolution of the images or because of programming issues...

You're using icon size 30x30 which I assume is for 1x (iPhone<4). Since iPhone>=4 needs 2x and 3x images so you have to include that also.
Either 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 your 1x, 2x and 3x images there and use it.
Reference Xcode Assets Catalogs

Probably because using a device with the retina screen.
Try about changing the icon's filename to xxx#2x.xxx like "facebook_icon#2x.png".

Also, be aware that you can use a PDF file (vector graphics, resolution independent) instead of PNGs, and Xcode will render the appropriate resolutions at build time for you (I don't think you can easily do this for third party icons such as Facebook, but...).
To see how this is done, create a new project using the "Tabbed Application" template, and check the asset catalog for the tab bar icon images. It does just that for the circle and square icons of the "First" and "Second" initial tabs.

Use this line of code to set image for uitabbaritem in uitabbar .
tabbaritem.image = [[UIImage imageNamed:#“image”] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];

Related

blurred icons on ipad

I have images supporting 1x, 2x and 3x.
Images are placed into an image set into the respective 'containers': 1x, 2x, 3x.
In Image attributes, I selected 'universal'.
However, during testing we can see that the images are blurred on an ipad (tested with ipad 2).
Not sure what am I doing wrong. Do I have to explicitly select device image set (e.g. ipad image set)?
Do I have to explicitly append 1x, 2x and 3x to the image name? For example, my-image#2x.png?
I have no issues across all iphones (4S, 5, 6/+, 6s/+, se).
I looked at various answers including this one but I am still not clear why my images are blurred on an ipad.
App icon is NOT blurred!
Icons are added to the view as follows:
toolbar items - images are set in storyboard using the image set name
tab icons on UITabBarController - added via storyboard using the image set name
map annotation callout - callout button image set with:
leftButton.setBackgroundImage(UIImage(named: navigateCue) , forState: .Normal)
Should also state that all my icons follow these guidelines provided by apple.
Also, on a simulator everything is fine...
This is how my folders are set:
In Images.xcassests I have a directory called multi-res.
In this top level directory I have sub-folders associated with the 'role' of the images (e.g. toolbar).
Each of the subfolders contain image sets (e.g. pins). An image set is named as 'red' (for red pins).
Within each image set I have 3 images: <base>.png, <base>#2x.png and <base>#3x.png
I have checked all images in both finder and sketch. They are exact in size and multiples. So if the <base>.png is 24x24, the <base>#2x.png is 48x48 and the <base>#3x.png is 72x72.
Everything works fine on all iphones (4s, 5, 6/+, 6s/+, se) and new ipads.
The issue remains with old gen ipads such as ipad 2.
I followed apple's guidelines stated here.
Do I need to create images with ~ipad extension too just for ipad2?
Do I need to have a #2x-1.png, #2x-2.png? If so, how do I create all these folders under an image set?
Something else?

Image in Storyboard LaunchScreen isn't retina

I'm creating a launchscreen with Storyboard, and am using a UIImageView. I specify the image named, and when my app opens, the launch screen shows a blurry version of my image (it's not using to 2x version of the image).
I later programmatically show the same image using [UIImage imageWithName:#"name"], and it shows retina as expected.
The image is saved in an Image Assets file, and I specify the #1x, #2x, and #3x versions.
Any ideas?

Choosing image from Assets it is not showing in Tab Bar Controller in SWIFT

I have a ViewController which is embed in Tab Bar Controller. I wanted to add custom icon to Tab Bar (in Main.storyboard), which is already exist in my Assets. When I do that, I don't see the icon but grey square. After when I run the app, I still have a grey square, not my own custom icon in .jpg. Describing picture bellow.
Grey square in launched application
Grey square in Xcode
Can somebody help me, how to show my own icon?
Check the alpha channel of your images. They should have some transparency. If not, UITabBarItem will show them as a square you've provided on the screenshot.
You could try a .png file possibly with some transparency in the image and make sure you have your image.png, image#2x.png and image#3x.png sizes in your Assets for retina etc.
If this doesn't work try just loading the image into a uiimageview to see if it loads okay. if it doesn't then it might be an issue with the image itself so you could try re saving it again.

Imported assets in Xcode are huge

I'm trying to make an iOS app in Xcode and the problem that I'm having is that the images that I have imported to use are huge. I first designed my app in photoshop and then extracted each asset out separately. I made sure that everything is the correct size. Every asset adds up to the iPhone retina resolution (1136 x 640).
But when I put these assets into the storyboard they are too big and go off of the screen.
Make sure you called them like imageName#2x.png and that you put them in the 2x section in the asset catalog. Otherwise the images would be treated as non retina images and they would be displayed in the double size.
Check that you are viewing them at the 4" iPhone, since the 3,5" is only 960px height.
Or you might have a opaque status bar, navigation bar or tab bar that decreases the available screenheight.

Tab bar icons on retina display

I am making an iPhone App but I can't understand why my custom tab bar icons are pixelated. They are 30x30. If I change the resolution to 60x60, for example, the icons are still pixelated but they are also incomplete.
Can you help me to fix this problem? Thank you very much.
You don't need to double the size of your non-retina images.
You need to create two separate icons icon.png (30x30) and icon#2x.png (60x60).
iOS will automatically load the right file based on the screen scale.
You can find more information about taking advantage of the retina display at this url: https://developer.apple.com/resources/high-resolution/

Resources