inforeqd
inforeqd

Reputation: 3249

Considerations for making 3rd-generation iPad applications

I am currently making an iPad application where the Views were created for iPad 2 resolution. However, now that iPad has come out with double the resolution, I also need to support that. Pls direct on what changes to make in the application so that both iPad 2 and 3rd-generation iPad are supported. The only way I can think of is programatically controlling the view frames and laying out the subviews which will be nightmare :-). Pls help if there is a better, more scalable way of doing it.

Thanks so much for all your help in advance.

Upvotes: 3

Views: 215

Answers (2)

sch
sch

Reputation: 27506

You don't have to change the frames of your views. The only thing to do is to add double resolution versions of the images you use.

So if you have an image called MyImage.png with a size of 100x100, add a new image called [email protected] and with a size of 200x200.

There is no code to change. If you respect the convention of adding the suffix @2x to the names of your images, then, the right image (standard or high resolution) will be used according to the screen resolution of the device.

Finally, don't forget to add icons and launch images with the correct dimensions for the new iPad.

Upvotes: 4

Jim
Jim

Reputation: 5960

In the documentation called "View Programming for iOS: View Geometry and Coordinate Systems", you find this:

View Geometry and Coordinate Systems

The default coordinate system in UIKit has its origin in the top-left corner and has axes that extend down and to the right from the origin point. Coordinate values are represented using floating-point numbers, which allow for precise layout and positioning of content regardless of the underlying screen resolution. Figure 1-4 shows this coordinate system relative to the screen. In addition to the screen coordinate system, windows and views define their own local coordinate systems that allow you to specify coordinates relative to the view or window origin instead of relative to the screen

In other words, you are not programming view dimensions in pixels, and your existing dimensions are automatically converted to match the underlying screen resolution

Also, with the retina display, you can provide image files with twice the resolution of the orignal non-retina displays, and use the @2x naming suffix in the image name.

Upvotes: 0

Related Questions