How does this #2x works for videos? - iphone

We have this #2x stuff on iOS that loads images for retina devices, but what about videos?
Suppose I want to show a video on normal iPad and retina iPad. Do I have to have two videos, one normal and one #2x or just the bigger video?
I suppose the bigger video is enough, but I want to know what you guys think.
thanks.

iOS doesn't do it automatically like UIImage does. But you can check the screen resolution yourself and then decide which video you will play.
But I would recommend you to just use a video which resolution is high enough to play well at #2x resolution since the resolution will be downsized anyway if it is too large.

Related

What about movies on retina #2x?

We know how things work with images on retina with #2x and without it. But what about movies?
Do I have to have a movie double the resolution of the other for retina displays? The naming convention #2x stands for movies? What about having just the bigger one and make it fit full screen?
When it comes to videos, there is generally no reason to include two files. Your non-retina device should still be powerful enough to be able to play higher resolution videos (within reason). The videos will just be scaled down to fit the frame of your video player.
Since you are targeting iOS 7, you will still have iPad mini and iPad 2 non-retina devices.
Videos are generally compressed with h.264, and they scale quite well. Even upscaled videos look fine, without much added blockiness. Smaller resolution videos of the same quality are smaller in size. Therefore, when choosing the video resolution, you might choose somewhere between non-retina and retina resolutions, and thereby save on storage space as well.

Suffix for Retina Images in iPhone 5

I have some image files for iPhone 5 size 640x1136, i have previously implemented retina images for iPhone 4 & 4S using #2x suffix, so what will be the suffix for images in iPhone 5, we can user the same as is #2x or it has to be changed.
It’ll still use #2x images where they’re available. There’s a -568h suffix you can use for the launch image, as in Default-568h#2x.png, but that’s currently the only place it’s supported; see Leo’s answer for a way to get that working elsewhere.
See my answer here. Some useful macros to help you with dealing with images.
For the iPhone Retina 4-inch (iPhone 5) it's still the #2x suffix because the density is the same as the iPhone Retina (iPhone 4 and 4S). The screen is bigger but have the same density.
The -568h suffix will work only in for the default image because it's the only place you really need it (just to tell the system that your app have been optimized for this new screen size, and it can stretch your views).
The naming convention Default-xxx.png is just here to provide the right image while the app is launching but I think it's non sense to try to replicate the same to load other images in imageViews. It's like the Default-(landscape|portrait).png on iPad. You never need this convention to load images yourself.
The only rule is:
# is for density (2 density exist right now, normal and 2x)
~ is for device (2 different devices exist right now, iphone and ipad)
To adapt images/imageView on the 4-inch iPhone you should play with your imageView content mode and the autoresizing configurations.

What happens if #2x image is available but not regular resolution image?

I'm wondering what will happen on a non-retina display device if only the #2x image is copied to the resources? Will it scale down the retina display image by 0.5 to accommodate the frame of the UIImageView?
I hope this isn't a silly question!
The high resolution #2x images are not automatically down-sampled on non-retina devices.
Apple did not implement such feature because non-retina devices generally don't have enough memory to load and down-sample many high resolution images during initialization, it might cause trouble in case too many images need to be initialized.
EDIT (Based on answer by WendiKidd)
Non-retina devices will however down-size and display the high resolution #2x images, but without down-samling them, which causes poor image quality.
I know for a fact that it will use the #2x images if no regular image is available, because I have tested it myself. (Though I agree with David's comment--this is rather easy to test yourself.) Now the image quality is decreased, because it's trying to resize an image that is much larger than the space you're trying to put it in. But it absolutely will work. Go give it a try and you'll see :)

save image in iPhone photo library with high resolution with retina display

I'm developing an app in which i have to save images in iPhone photo library. When i'm saving image in iPhoto library in app programmatically i want the image to be saved with high resolution with retina display. How can i achieve this?
Its upto your requirement how you are saving the images in the application. If you are resizing the images while saving them then you can try to save a better version as well so it may work in both resolutions. However, the question is very vague. Please do give some more explanation.

Convert iPhone app to universal binary (part II)

I have adjusted my target to be universal. Now the images look scaled up. Do I have to have every image twice, in different resolutions?
What's the correct way to do this? Or do I make images in iPad resolution and use them on the Phone as well?
And: if I do have to duplicate every image, is there a convention such as having the img.png for the iPhone in the Resources folder and the img.png for the Pad in the Resources-iPad folder?
Many thanks for your help!!
No I just suggest having them in one resolution (iPad) and they will scale down.
Actually I suggest making all graphics Retina compatible and then they will look fine on the iPad.
The best, and well the correct way to do this is to have 3 of every image
320x480 Default.png for iPhone
640x960 Default#2x.png for iPhone 4
and for iPad 768x1024 iPad Default Image sizes
But if your trying to keep your app as small in size as possible then making the images in retina resolution would be the best way to achieve this. The difference on iPad if scaled correctly wouldn't be noticed. Just be sure not to title the retina images with the "#2x" suffix and scale to fill on low resolution for low resolution iPone interfaces.