What size images should I use in order to support the two iphone resolutions? - iphone

I have a few questions about screen resolution, that I'm not clear on. These questions assume they my app will be running on iOS 4.0 and up, and on either iPhone 3GS or iPhone 4.
Should the size of the splash image (default.png) be (960x640) or (480x320)?
Should the size of the app icon (Icon.png) be (57x57) or (114x114)?
What about other graphics that I may use in my app, such a graphic that represents a button? Should I always create these images for the higher resolution, and have the app scale them down? In other words, if I want a button image to be displayed on the 3GS that is 200x40 - should I create the image at 400x80, so that iPhone 4 can take advantage of it?
Thanks!

A good guide to this can be found here: http://mobile.tutsplus.com/tutorials/iphone/preparing-your-iphone-app-for-higher-resolutions/
In general you just create 2 sets of images. Your original and then a new one twice as big with #2x in the name. So for image.png at size 32x32 you would have one that is twice the resolution called image#2x.png at size 64x64. In your app just always use the image.png in Interface Builder and when loading in code.
There is no need to detect the device. These images will automatically be picked up by the OS and subbed in as necessary.
Provide both sizes (960x640 & 480x320) for the splash image using the #2x method described above
Provide both icons (57x57 & 114x114) using the #2x method
For our apps we use a combination of the #2x images and just Scaling the large images. (More information on this can be found in the above article) We use the #2x images for bar buttons, icons, etc. But for UIImageViews we often just use the Scaling. There can be a performance hit for doing this, but for most apps I'd say this is negligible. The savings in file size sometimes make scaling the only option.
Related Questions:
Retina/non-retina images in UIImageView
Making an app Retina Display friendly

You need to provide both if you want them to look nice. For example,
Default.png -> (480x320)
Amd
Default#2x.png -> (960x640)

Related

The minimum number of launch images for a Universal App

I have a universal app which supports both orientations and all resolutions, so there are a bunch of possible splash images (iphone & ipad, portrait & landscape (left/right), retina & std display). But there is no sense to show anything except the background image as a splash image for my app. And the background is just a simple repeated pattern, so ideally I just specify a little 10x10 pixels image and tile the screen with it.
But as I understand it's not possible, and I need to provide a bunch of pre-rendered full-screen images. So I wonder what is the minimum number of images that is required for a Universal app? Will just one Default.png be enough?
In your case i would place 4 Default png's.
And yes. You need to pre-fill your 10x10 tiles in a (or multiple) big default.png files.
two for iPad (iPad / iPad Retina) and two for iPhone (iPhone / iPhone retina).
You need to set the base name in your app plist.
Look for Launch image (iPad) then enter there DefaultiPad (or something like this). Then you should place a DefaultiPad.png and a DefaultiPad#2x.png within your project resources.
Do the same for iPhone.
Look after Launch image (iPhone) in your app plist and do the same with a different base name.
Update 1:
You can also add Default.pngs for each device orientation.
Easiest way is to go with [Basename]-Landscapen.png and [Basename]-Portrait.png.
So in the case above you can place your files with the filename DefaultiPad-Landscape.png and DefaultiPad-Portrait.png
But this will also increase your binary filesize which – maybe for your 10x10 tile case - will not be worth doing so.
Because you are asking for the minimum:
Every app must provide at least one launch image. This image is typically in a file named Default.png that displays your app’s initial screen in a portrait orientation. However, you can also provide other launch images to be used under different launch conditions.
Source: App Launch (Default) Images
However, I also would suggest to use at least 4 (iPad + iPhone each in normal and #2x).
The minimum number you can provide is zero. If your app is quick to launch, you don't need to supply one. If your app is slow to launch, make it faster by putting heavyweight stuff on a background thread and get the UI (or a plain view with your tiled pattern) on screen as fast as possible.
You can't do it by just providing a small image and having it tile, you have to provide an actual, pre-made image for everything you want to support. In your case:
4 images for iPad (Landscape, Portrait, Landscape 2x, Portrait 2x)
2 images for iPhone (Portrait, Portrait 2x)
Left and right are the same image, unless you do something different with those orientations. Upside-down is the same too.
If you think that's a lot, wait until you see how many icons you need.
More info is at App Launch (Default) Images

Not including non-retina display images in an iPhone project

I have an iPhone Xcode project that currently only contains images for retina display (twice the size as normal and with a #2x.png suffix). When I run the app on the iPhone Simulator (non retina) the images are still being displayed. Does this mean I don't need to worry about including two sets of images: retina and non-retina?
This all seems a bit odd. I would assume that no images would appear on a non retina device if there are no non-#2x files included.
Note: I have not tested my app on a non retina device. Just the simulator.
I'm pretty sure that iOS will just use the #2x and scale it down if you don't have a non-retina graphic. Although that's sub-optimal since you're letting iOS do the scaling at runtime which will be slower than including the non-retina graphic and also iOS might not do as good a job as scaling as your graphics editor of choice.
Even if it works, it's not good practice, and if you have a media heavy app definitely it would impact performance and battery life and memory foot print and ....
By the way, is it just that you don't have the 1x graphics available to you or you are concerned about your apps (download size) or ...
If you are assigning the images in Interface Builder, and you set the image property on a UIImageView to image#2x.png, for example, iOS will not know that it's a high resolution "2x" image. In fact, on a retina display, iOS will look for an image named image#2x#2x.png. Since it won't find it, it will set the scale factor of the image to 1.0.
The contentMode property (just "mode" in XCode) will decide if any scaling of the image occurs to fit the constraints of the UIImageView. You may wish to set the mode to "Aspect Fit" to get the high resolution image to scale as needed for both retina and non-retina displays. In general, the image will display as seen in Interface Builder.
If you are using UIImage's imageNamed or similar function to load the image, and just specify image (where "image.png" doesn't exist, but "image#2x.png" does), then iOS will actually find the image on a non-retina display, though the scale factor will be 1.0. As previously, you'll need to scale it to fit your view. The image will work normally on a retina device, and the scale factor will be set to 2.0, since iOS looks for a "2x" image first, and it doesn't matter if the other file exists or not.
This is from Apple's documentation on imageNamed:
On a device running iOS 4 or later, the behavior is identical if the
device’s screen has a scale of 1.0. If the screen has a scale of 2.0,
this method first searches for an image file with the same filename
with an #2x suffix appended to it. For example, if the file’s name is
button, it first searches for button#2x. If it finds a 2x, it loads
that image and sets the scale property of the returned UIImage object
to 2.0. Otherwise, it loads the unmodified filename and sets the scale
property to 1.0. See iOS App Programming Guide for more information on
supporting images with different scale factors.
If at all possible, you really should include both retina and non-retina images. Using higher-resolution images than necessary negatively affects memory and performance.

Making an app Retina Display friendly

I have an app and would like to make it retina display friendly.
How exactly does the process work? What images need to be added apart from what I have?
I know the sizes should be different, but am not sure on the details?
What else needs to be done to handle retina display?
Should the device be detected and use other images if the device supports retina display?
What if there are a lot of images? And how will this effect the app size?
Thanks
A good guide to this can be found here: http://mobile.tutsplus.com/tutorials/iphone/preparing-your-iphone-app-for-higher-resolutions/
In general you just create 2 sets of images. Your original and then a new one twice as big with #2x in the name. So for image.png at size 32x32 you would have one that is twice the resolution called image#2x.png at size 64x64. In your app just always use the image.png in Interface Builder and when loading in code.
There is no need to detect the device. These images will automatically be picked up by the OS and subbed in as necessary.
good articles if you're using sprites
http://weedygarden.net/2012/04/hi-res-retina-display-css-sprites/
The main thing about working with retina image is that image name convention.
And the size of image should be 2times greater than regular1.
Example- if your icon name for regular is icon.png then it should be icon#2x.png for
retina.And second thing is size for regular is 72*72 then it should be 144*144 for Retina.
It might be helpful for you.
Thnks

When I create an iphone window based app, how to tell interface builder create window for retina pixel size?

I hope to create an iphone window based app for retina screen?
But I found that the size of window in mainwindow.xib is fixed.
How to adjust it or there is any to tell interface builder create window for retina pixel size?
Welcome any comment
Thanks
interdev
There's no need to do anything in terms of the various components you layout in Interface Builder, as it's based around points, not pixels - and as all the iPhone screens sizes are the same in points no action is required.
In terms of any images you're loading, you will need to supply higher resolution (twice the pixel size) versions, but as long as these are named "[original name]#2x.[extension]" they'll simply work automatically.
For more information on the image naming, see the "Specifying High-Resolution Images in iOS" section of the Resource Programming Guide and if you want to delve a little deeper, there's a discussion on "Points Versus Pixels" within the Drawing and Printing Guide for iOS.
UPDATE - As of the iPhone 5, the iPhone screens are no longer all the same point size. :-)
The window will be automatically resized for you, you do need concern about the size of your image elements, since retina display uses a bigger size of resolution. You need name your images like this:
regular image name: myimage.png
retina image name: myimage#2x.png
When running in an iPhone4 your program will identify the token "#2x" and change the images for that kind of device.
Design your layout using the size of: 640x960 (double of the original: 320x480)
Good luck.

can the ui design for old iphone be used on iphone4?

I'm developing my software, all the ui is drawn based on 480x320 size screen, can my software run on iphone4 without any modification?
Yes it can run with no modification.
If you'd like to create "retina" assets you can create all of your images at the double resolution and include copies with '#2x' appended to the filename in your Application bundle. The iPhone will automatically load the correct images.
Example:
existing image - myImage.png
new up-sampled image - myImage#2x.png
Yes, but any images sized for the earlier iPhone models will look chunky compared to custom-designed iPhone 4 images.
Both the iPhone 4 and older devices are 320x480 points in size, which is the coordinate system that Core Graphics and UIKit uses. So your software will run the same.
Only the automatic scaling between your bitmaps and the display will be different. If you have bitmapped content or images, you can optionally provide #2x sized versions that will look somewhat smoother without the 2X scaling on iPhone 4 devices. This is nice, but optional.