What do we need to do to develop a program compatible with IOS retina?

Source: Internet
Author: User

1. First, make it clear:

The pixel resolution of the iPhone 3g/3gs screen is 320x480;

IPhone 4 and iPod tou4's screen pixel resolution is 640x960.

2. In order to be compatible with apps before IOS 4.0 and run on iOS 4, Apple designed a logical Resolution Unit (point ).
One point on iPhone 3 is equivalent to one pixel, while one point on iPhone 4 is equivalent to four pixel;Therefore, the point resolution of all iPhone and iPod Touch devices is 320x480.That is, the logic resolution is consistent, ensuring that the app can run normally at a high-pixel resolution without modification, but the images in the app will be pulled up and displayed, affecting the appearance, did not take advantage of retina.

3. What should iOS app designers and developers do?

1) for the app icon design, the app released to store must also provide the app icon with a high-definition size (a high-definition version should be provided based on the original version). For details, refer to the official Apple documentation.

2) The static UI image materials referenced in the Code are also provided in two copies, one for low pixel resolution and one for high resolution.

For example: the original app material package has a demo.png, then APP bundle must provide another two times the size of demo.png, and the file name is demo@2x.png and added to the project;

In the code, you can still write [uiimage imagenamed: @ "demo.png"] in this way. without modifying the code, the IOS system can automatically retrieve image files of different sizes on different screens.

3) if the app is running and asynchronously retrieves images from the network for display, or dynamically generates images in the game app for display, you need to add code to determine different screen devices to get/generate different size images.

If ([[uiscreen mainscreen] respondstoselector: @ selector (scale)] & [[uiscreen mainscreen] scale] = 2 ){

// Enable 2x display iphoneapp on retina or iPad

// Obtain the HD Size Image

}

Else {

// Obtain a low-definition image

}

From: http://my.oschina.net/yongbin45/blog/69545

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.