Development, for example: Nanshanimage.image=[uiimage imagenamed:@ ' index_pic.png ');
In the project also saved in [email protected] picture, this figure in order to only adapt to 960*640 resolution of the phone
Note: To adapt to the Iphone5 of the relevant picture size, but also add @2x.png. Like the Welcome interface: [email protected];
And Index_pic.png is adapted to 640*320 's mobile phone, but in the code must be written in [UIImage imagenamed:@ ' index_pic.png '], so the system automatically according to the different resolution of the phone to decide whether to call [email Protected] or index_pic.png, which is automatically matched to the resolution to use which picture.
However, if written as [UIImage imagenamed:@ ' [email protected] '], then the system can not automatically determine, according to the 640*320 resolution to call Index_pic.png pictures, the system will only [email protected] This image is a picture of a control and does not automatically look for a match.
Therefore, in the development [UIImage imagenamed:@ ' index_pic.png ']; The images inside are all pictures with small resolution format names, which automatically adapts to large resolution images and calls directly.
The UIImage class handles all the work required to load a high-resolution picture into an application. When creating a new image object, simply request the standard and high-resolution versions of the picture with the same name. For example, if you have two picture files named Button.png and [email protected], simply request a picture with the following code:
uiimage* animage = [UIImage imagenamed:@ ' Button '];
Note that in IOS4 and later versions, you can omit the file extension and provide only the picture name.
Under the high-resolution display, imagenamed:, Imagewithcontentsoffile:, and Initwithcontentsoffile: method to automatically find a picture with a @2x name (note: If the @2x.png picture and the. png image must be placed under the same package in the project, you can find it automatically). If found, the picture is loaded. If you do not provide a high-resolution version of a given picture, the image object will still load the standard version of the picture resource and scale it during the painting process. If you have a high-resolution version that provides a given picture, but there is no standard version of the picture, the HD image will not be loaded under the Standard Edition display.
Description: 1,create folder references for any added folders
Create a physical path that introduces the structure of the Blue folder. Using Imagewithcontentsoffile to get pictures, @2x.png and. png must be in the same blue directory.
2,create groups for any added folders
When importing a file, it will be the logical structure, not the physical structure, the directory structure icon is as follows, the yellow folder structure, and the build group is the same, @2x.png and. png can be in different yellow folders (because there is no physical path, the referenced picture path is actually under the same path).
Note: Xib the same principle when choosing a picture to do the background! Also choose not to take @2x, this will bring your own according to the resolution to match whether to use a small map or @2x large map!
Reward
Development, for example: Nanshanimage.image=[uiimage imagenamed:@ ' index_pic.png ');
In the project also saved in [email protected] picture, this figure in order to only adapt to 960*640 resolution of the phone
Note: To adapt to the Iphone5 of the relevant picture size, but also add @2x.png. Like the Welcome interface: [email protected];
And Index_pic.png is adapted to 640*320 's mobile phone, but in the code must be written in [UIImage imagenamed:@ ' index_pic.png '], so the system automatically according to the different resolution of the phone to decide whether to call [email Protected] or index_pic.png, which is automatically matched to the resolution to use which picture.
However, if written as [UIImage imagenamed:@ ' [email protected] '], then the system can not automatically determine, according to the 640*320 resolution to call Index_pic.png pictures, the system will only [email protected] This image is a picture of a control and does not automatically look for a match.
Therefore, in the development [UIImage imagenamed:@ ' index_pic.png ']; The images inside are all pictures with small resolution format names, which automatically adapts to large resolution images and calls directly.
The UIImage class handles all the work required to load a high-resolution picture into an application. When creating a new image object, simply request the standard and high-resolution versions of the picture with the same name. For example, if you have two picture files named Button.png and [email protected], simply request a picture with the following code:
uiimage* animage = [UIImage imagenamed:@ ' Button '];
Note that in IOS4 and later versions, you can omit the file extension and provide only the picture name.
Under the high-resolution display, imagenamed:, Imagewithcontentsoffile:, and Initwithcontentsoffile: method to automatically find a picture with a @2x name (note: If the @2x.png picture and the. png image must be placed under the same package in the project, you can find it automatically). If found, the picture is loaded. If you do not provide a high-resolution version of a given picture, the image object will still load the standard version of the picture resource and scale it during the painting process. If you have a high-resolution version that provides a given picture, but there is no standard version of the picture, the HD image will not be loaded under the Standard Edition display.
Description: 1,create folder references for any added folders
Create a physical path that introduces the structure of the Blue folder. Using Imagewithcontentsoffile to get pictures, @2x.png and. png must be in the same blue directory.
2,create groups for any added folders
When importing a file, it will be the logical structure, not the physical structure, the directory structure icon is as follows, the yellow folder structure, and the build group is the same, @2x.png and. png can be in different yellow folders (because there is no physical path, the referenced picture path is actually under the same path).
Note: Xib the same principle when choosing a picture to do the background! Also choose not to take @2x, this will bring your own according to the resolution to match whether to use a small map or @2x large map!
Reward
iOS development @2x images, etc. adapted to different resolutions of the mobile phone