I am using three versions of image:
abc.png
abc#2x.png
abc#3x.png
I just want to know that if I use abc.png wherever this image is used, does all the versions are automatically picked according to iPhone resolution or I have to make an image asset for this.
I did a Google search but nothing satisfactory found.
When we use any image in your app it pick the image according to the device resolution which set constraint by the APPle Inc.
The Asset is listed below for more clarity:
iPad 2 and iPad mini (#1x)
iPad (Air) and iPad mini (Retina) (#2x)
iPhone 4s (#2x)
iPhone 6 and iPhone 5 (#2x)
iPhone 6 Plus (#3x)
For all images and icons, the PNG format is recommended. You should avoid using interlaced PNGs.
I wish it'll help you.Let me know if further more concern.
only write #"abc".
it selects the desired image automatically
In the last 6 months I have been able to make a pretty good app in iOS Swift. But Now I want to touch upon some performance and best practices in development.
So I wanted to know what is the best practice of using images in Xcode? To be specific, I usually drag and drop images in my project folder to use it inside my app. But I know that we can also use image.xcassets to do the same thing.
The question is, which one is the right way? Or which one should be used when?
I have seen in image.xcassets we have to provide 3 images. 1x, 2x and 3x. Does that mean that I am increasing the size of the app (considering I am using many images)? Also how does it effect the performance? Is there any difference in fetching the file from project folder or from image.xcassets?
On the top of my head "Image.xcassets" has a bug in Xcode 6 where you cannot load JPEG images. Other than that, it is the best practice of organizing your images. The 1x, 2x, 3x are for the different screen resolutions of iOS devices. 3x images load on iPhone 6 Plus, 2x on any device with a retina screen (iPhone 6, iPhone 5/5s/5c, iPhone 4/4s, etc), and 1x on some of the older iPads and iPhones
Since the induction of 6 and 6 plus its the first time I'm starting to work on a new app. Now I'm a bit confused about the use of graphical assets for my app. See for 5/5S things were pretty simple. If I have to make an image view of lets say 180 x 30 points then my image would of 2x resolution that would be 360 x 60 and would fit pretty good inside my image view. Now since 6 and 6 plus have different screen sizes than 5/5S and different resolutions, what is the recommendation here. Should I keep the image view size same on all three devices that is 180 x 30 points. If so, what image resolutions should I be using for the 3 different devices. It would be 2x for 5/5S but what about 6 and 6 Plus and how will Xcode determine to load those automatically? Or should I use different image view size that is larger than 180 x 30 for 6 and 6 plus? Im confused here that how this all works. Help is highly appreciated. Thanks
So your image view size should always be the same amount of points on the phone. Your image will be in the assets and will be different based on the device.
So if on the non retina screen you had 180x30 and on the 5s retina you used 360x60, you would keep the same 2x(360x60) for the 6 and then 3x for the 6+(540x90)
Just add the images to your assets in the correct buckets and it should be taken care of for you.
You should keep your image view point sizes the same but you should add a new pixel resolution for all of your images (3x) which will be used for the 6+. Although the 6+ is slightly less than exactly 3x resolution, the OS does some scaling so that you can just give a 3x image and it will work correctly.
A couple of Xcode versions ago Apple added asset catalogs that make it incredibly easy to manage having multiple resolutions. Just simply drag the correct images into their correct resolution bucket and it will work automagically. Much simpler than having to append #2x and #3x to all of your images like in older versions.
I am using scaled up views for iPhone 6 and 6 plus for my app i.e. I haven't added splash screen for iPhone 6 and 6 plus.
I would like to know will the iPhone 6 and 6 plus will use high definition images (#3x) or as it is only scaled up app so will use retina images (#2x).
Kindly let me know if anyone has came across this.
It will not use #3x images until you add launch screens.
Thanks all for your reply.
Today I created one POC using 1x, 2x and 3x image and tested it on simulator. Look like application is using high definition image for iPhone 6 plus. I have attached images for reference.
I don't have device to test this POC. Hope this will behave same on device.
Currently working on a universal SpriteKit project. I'll be supporting the following devices:
iPhone 4/s,
iPhone 5/c/s,
iPhone 6,
iPhone 6+
iPad non-ret,
iPad retina
I am confused on the iPhone part. I already have 4 versions for my background sprite for the 4 different screen resolutions of the iPhones. But which goes to which?
I know the 3x is for the 6+, and I think the 5/c/s goes to the Retina 4 2x, but I do not know where the iPhone4/s, and 6 go. Anyone know?
Side note, when I create a Launch Image inside my xcassets file, I am shown these options, which basically has all the device I am supporting. Just wondering why this is not also the case when creating an Image Set
Also how do you guys approach creating images/sprites for a universal application? Now that the new iPhone 6, and 6 plus are out, I have 2 more resolutions to support which is still confusing for me as I'm still a beginner.
This is a little confusing - here's how I understand it (this is in reference to the top image):
1x images are for the original iPhone through the 3GS - 'standard' resolution devices (3.5" screens)
2x images are for the iPhone 4 and 4S (3.5" Retina screens) and are also used for the iPhone 6.
Retina 4 2x are for the iPhone 5 and 5s (4" Retina screens)
3x images are for the new iPhone 6+ (5.5" super-Retina [3x] screen)
I believe that the iPhone 6 (4.7" screen) will use the Retina 4 2x images, but I would have to test it.
Side note, when I create a Launch Image inside my xcassets file, I am shown these options, which basically has all the device I am supporting. Just wondering why this is not also the case when creating an Image Set
If you compare the two images, the lower one has everything the upper one does, except for a 1x iPhone graphic. You don't need that if you're only supporting iOS 7 and above, since iOS 7 doesn't run on any non-Retina phone-form devices. To be honest, I don't understand why the top image has a 1x iPhone form graphic option - maybe because you checked the "iPhone" box in the sidebar?
Also how do you guys approach creating images/sprites for a universal application
For most non-fullscreen images (like a logo), you really only have 3 resolutions to support - standard (1x), Retina (2x), and the iPhone 6+ (3x). These are simply different quality of images, not really different sizes. So if you have a 10x10 image on a standard device, that would mean you need a 20x20 image on a Retina device and a 30x30 image on an iPhone 6+. On all devices, they would show up as a 10x10 image.
A great tool I used for managing different resolutions of icons is iConify.
I create them at the highest size I need (30x30 [#3x] for an image I want to be 10x10 on a device), then save it as a png and resize copies to 20x20 [#2x] and 10x10 [standard]. A better solution would be to create and use vector graphics, which would resize better to any size.
In 1x place image with resolution 320 x 480.
In 2x place image with resolution 640 x 960.
In Retina 4 2x place image with resolution 640 x 1136.
in 3x place image with resolution 1242 x 2208.
Images of Retina 4 2x will upscale to resolution 750 x 1334.
Images 3x will downscale to resolution 1080 x 1920.
You can also visit this links for launch screen images:
http://www.paintcodeapp.com/news/iphone-6-screens-demystified
http://www.paintcodeapp.com/news/ultimate-guide-to-iphone-resolutions
For all other images resolution and size:
https://developer.apple.com/ios/human-interface-guidelines/graphics/launch-screen/
https://developer.apple.com/ios/human-interface-guidelines/graphics/image-size-and-resolution/
https://developer.apple.com/ios/human-interface-guidelines/graphics/custom-icons/
How to use Image.xcassets:
https://www.youtube.com/watch?v=_36Y6rDcKP0&list=PLXCowKcXAVgrCe2Lezv0acRf4adQLshv2
Hope this will be more helpful.
If you have your launch images in an xcasset file, you can do the following in Xcode 6.
Select the launch image asset, select a specific resolution (1x, 2x, Retina 4, etc) and open the attributes inspector (see image below).
Under the "Image" section, you will have a "Expected Size" attribute.
Inside images.xcassets, you can add different devices support by right clicking as shown in the snap
Edit: Well, it doesn't seem working when I drag n drop images to placeholders. It gets messed up as shown next
I don't know why it is acting odd on my Xcode 6.4 though.
Edit#2:
I see a bug from apple here. I can select 'Universal' along with any device upon right click as you can see in the first image above. But via attribute inspector I can correctly select either 'Universal' or specific devices as shown here
Edit#3:
In Xcode 7 the attribute inspector has been changed and now it gives option same like the right click. So instead of either 'Universal' or specific devices, now it offers to select all.
There is one tool : AVXCassets Generator with which you can directly generate XCAssets file for all your icons and images just by one click.
hope you will like it.