Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

About IPhone4 screen resolution

I read from http://www.apple.com/iphone/specs.html that IPhone4's screen is 960-by-640-pixel resolution at 326 ppi.

But in Xcode's IPhone4.3 simulator, when I manipulate the display objects, print the [UIScreen mainScreen].applicationFrame, it is 320*480.

So if I wanna use a picture as the main screen's background of my app, which size I should use? 640*960 or 320*480?

Or Which kind of images should I use ? The size of images can affect the details a lot.

like image 426
Matt.Z Avatar asked Jul 05 '11 01:07

Matt.Z


1 Answers

You can use both.

If you want to develop apps to Retina Display (iPhone 4), then you should use image with double resolution (640x960), then, when you create your UIImageView, you divide the size by 2.

CGRect rect = imageView.frame;
rect.size.width /= 2;
rect.size.height /= 2; 
imageView.frame = rect;

Also, you have the option to have a image with @2x on its name, for example [email protected] (640x960). In this case, you don't need to divide the size. Using this way:

UIImage * img = [UIImage imageNamed:@"myimage.png"];

Your img var has already divided the size, and if you deploy to iPhone4 it has Retina Display resolution.

like image 130
Raphael Petegrosso Avatar answered Oct 13 '22 12:10

Raphael Petegrosso