Retina display compatibility - iphone

For our iPhone app, we are using 50 x 50 user image (from facebook). It works fine for iPhone 3G and 3GS but not for iPhone 4 due to its high resolution display. For iPhone 4 we tried to send 100 x 100 (variable height) image but it is not working for obvious reasons. Any thought?

You don't need to do anything different for the Retina Display. Using exactly the same image as you have on the older iPhone will work exactly the same.
If you have a higher resolution image that you'd like to display instead, then if you save the file with a #2x suffix then, if the device has a Retina display, it will pick that instead. In most cases it should not require any extra code.

Related

CGRectGet doesn't work well

I'm working in Swift with XCode 6 and Sprite Kit and I want to have the biggest pixel in y, so i'm using this function :
CGRectGetMaxY(frame)
and I tested my code with the iPhone 6 simulator, so the value should be 1334.0 but the console shows me only 667.0 ...
What is wrong ?
It appears you're working in "point-space" and not "pixel-space". Depending on your settings, your image (I'm assuming that's where 1334 comes from) is likely at a #2x resolution.
Check your assets folder to make sure the image is defined how it should be.
Check your scale settings
UIKit (and most of iOS) runs on point-space, so try to work in these coordinates - they abstract device resolution (important now that we have #1x, #2x, and #3x devices).
Point-space:
The original iPhone was 320x480 pixels. In order to have your code be device-agnostic, when they went to Retina, the screen and all the logic stayed at a resolution of 320x480. These didn't always correspond to pixels, so the terminology changes to "points". That's why when you grab the screen size for an iPhone 4 it still reports 320x480.
Apple's Documentation on this.

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.

if I changed app graphics for iphone 5 , is it going to work for iphone 4, 3GS properly

if I changed app graphics for iphone 5 , is it going to work for iphone 4, 3GS properly or the users have to resize the app like when you download iphone app in iPad ?
If you mean you are using both normal sized images and 2x images for retina display, you won't have a problem on older devices.
They'll just pickup the regular sized images while the ones with retina display will load the #2x ones.
What you do have to take into account is that if you don't include regular sized images (if you only use #2x images), older devices won't load them.
#2X will still work. However I did download xcode 4.5 with iOS 6 Gold Master seeds and played with it last night. The splash screen will include the new slightly higher resolution image 11??x640 as well as the 960x640 and 480x360.
For fullscreen images, you will have to supply at least two versions, better three.
One being 640 × 1136, one being 640 x 960 and one being 320 x 480.
For the 3.5" retina version, you may use the automatic selection (aka #2x). For the former 4" retina version it appears as if you will have to include your own code to select the right one.

Running app built in iOS4 on iOS 3.0, why is everything huge?

My background and my icons are all huge, like it's zoomed in 2x. Any ideas why?
Check the images in the app- there should be two sets of images, with one set being at double resolution and suffixed with "#2x". If there's just one set and they seem large, odds are the developer never intended the app to be run on a device that's not running iOS4 (which seems odd, but there it is).
That's because the apps in iOS 4 are targeted for iPhone/iPod 4 which have a resolution of 960 x 640, whereas iOS 3 has a resolution of 480 x 320. Do read about Retina Display of iOS for further details.

App running on iPhone 4 has a 320x480 resolution instead of 640x960

I'm creating an iPhone app, which will run on iPhone 3 and iPhone 4.
To that point, I was trying to make the images adjust to the resolution, but it turns out that even when running on the iPhone 4, the size of my window is 320x480.
On the XIB I specified "fullscreen at launch" and for the ViewController I even specified "Wants fullscreen", but I can never get it to recognise the actual resolution.
Am I missing something?
Is it running full screen on your iPhone 4? (I don't mean what resolution is being reported, I mean are there black bars around the app - I bet there aren't).
iOS is 'magical' in that you just deal with iPhone 3 size things i.e. xibs etc and it scales it correctly for you on the iPhone 4. You will always see the smaller resolution when you query the display.
To get images to load the correct resolution just create two versions i.e.
myImage.png
myImage#2x.png
Make the second one exactly twice the size of the first and the iPhone will do the rest.
PS There's a property that's been added to UIImageView called scale - it's how the iPhone knows how large to render an image - have a look at the docs here.