Is it possible to renderning non-retina image using retina image programmatically at runtime? - ios

is it possible to render non-retina images using retina images programmatically at runtime?
I'm developing an universal App, and there are a lot of images in my app bundle, make my app bigger and bigger and I'm trying to downsize my app....
I can't just delete all non-retina images, cause I need to support iPad mini without retina display.
So is this possible? Using retina images to render a non-retina images, will this cause fatal performance issue? or any other side effects?
Thank you very much.
Edit1:
#troop231 Yes, the 1st generation iPad mini and 2ed generation iPad mini both supports retina assets
#bstahlhood I thought I was doing something wrong so the universal App on 1st gen iPad mini not using the #2x images, looks like this is just another limitation from Apple.
So I guess the only solution is not to support 1st gen iPad mini or I have to add both non-retina images and retina images in my App bundle?

Yes - but you need to specifically set the frame dimensions for the image in every case by the 1/2 size.
e.g. retina image is 100x100 so if you use it make sure it has CGSize(50,50)

Related

Xcode 6 - xcassets for universal image support

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.

Non retina images – must I add them to xcode?

Because I made app (iphone) myself, with 200 images, I want not using non retina images.
It may be for me big problem to resize images for non retina display.
I don't have non retina display iphone, to test it.
Must I add non retina images to xcode, or not?
If I don’t add them, must I add “#2x” to all images for retina?
I tried my best to find answer for my question but there was no clear answer.
Thx for answers.
I thing it will be better make non retina display images, than buy non retina device for testing how it looks.
I have another question:
Button background needs #2x images and non retina display background images?
You must add non-retina images if the platform your targeting includes non retina devices (e.g. iOS 6 and earlier or iOS 7 iPad). If you do not, non-retina devices may not render your app correctly.
If you are not targeting a platform that supports non-retina devices (Eg iOS 7 iPhone), you may omit non-retina images. Your retina images will still need the "#2x" suffix in the file name for the system to find them.
I read somewhere that if you do not include non-retina images, the iOS will use the #2x images, scale them on the fly to non-retina sizes, but that may affect performance. Make sure you test on at least one non-retina Device to make sure it works.
This should not be too much of an issue. Test your app on the simulator using non retina and make sure your images are showing up properly. Your images should scale and won't cause a problem. It would be better if you could have both retina and non retina images but not a game beaker.

Images size for an iPad app

I'm developing an iPad app with lots of multimedia content and I want it to work both on retina and non-retina display iPads.
I would like to know if I have to include every single image that will appear in retina and non-retina resolutions like this:
image1.png 1024x768 Standard resolution for fullscreen iPad image.
image1#2x.png 2048x1536 Retina resolution for fullscreen iPad image.
Wouldn't it be enough with the retina resolution and if the app detects that it's running on a non-retina device, then shrink it? It seems to work that way in the simulator.
I'd like to keep the size of the app as low as possible and I don't think that duplicating all the image assets will help.

Necessary to have Retina and non-Retina for all images in iOS App?

Currently , all the UIImageViews in my app are set to scaleToFill mode, using only one retina image without setting any non-retina image. I suppose that on non-retina display, the extra resolution will be lost by itself.
Question: Is this approach acceptable? And will Apple disapprove my app due to the missing non-retina images for UIImageView?
Apple won't reject your app. However it's recommended to have non-retina versions if you're targeting Universal devices, since there are still lot of non-retina iPad out there, and scaling is slower and sometimes produces ugly images.
If you're targeting iPhone only, (IMO) there's no need for non-retina images.

How should I design images size to support all iOS Devices Retina Display

I'm developing a Universal Card Game and I will use different card size for iPhone-3.5inch , iPhone-4inch, iPad and iPad mini. I need the card to support Retina Display, so should I create 4 images ? like :
card_iphone35#2x.png
card_iphone4#2x.png
card_ipad#2x.png
card_ipad-mini#2x.png
or I only create 1 image for iPad Retina Display and then I use it for example in iPhone-3.5inch with UIImageView being scaled down ?
Yes, you should create an image for every device.
I recommend you to check iOS Human Interface Guidelines, it explain everything abut sizes, icons, images...
http://developer.apple.com/library/ios/#documentation/userexperience/conceptual/mobilehig/Introduction/Introduction.html

Resources