IPhone @2x with @3x picture loading problem

Source: Internet
Author: User

Tested By:

Suppose there are two pictures named: [email protected], [email protected]

Using Initwithcontentsoffile

nsstring  *path = [[ nsbundle   Mainbundle ]  pathforresource : @ " [email protected] "   oftype : @" PNG " ];

UIImage *image = [[UIImage alloc]initwithcontentsoffile:p Ath];

Ipone5 S, iphone6 and iphone6 Plus are all needed @2x/@3x the picture suffix name, otherwise the program will error, loading the picture depends on whether you write is @2x or @3x;


using imagewithname

< Span style= "COLOR: #6600cc" >uiimage *image = [ uiimage &NBSP; imagenamed : @ "test_t" ";

< Span style= "Color:rgb (51,51,51); Font-family:menlo; font-size:13px; Line-height:26px "> in Ipone5 S, Iphone6 and iphone6 Plus are not required to bring @2x/@3x picture suffix name, the program will load the @2x But if you need to load @3x picture, you need to write on @3x


use xib to load pictures, andimagewithname similar, but a little different is that you can't match[email protected],either matchtest_t. png, the program will automatically load [email protected] picture , either match [email protected] , program load [email protected] the figure;


last question, do not know why IPhone6 Plus will load the @2x image, in the case of the picture named test_t. png ? In that case , @3x of the picture meaning is not much, if each time manually to test will be more trouble, this is not science AH ~hope to have a friend to answer, thank you ~o (∩_∩) O

IPhone @2x with @3x picture loading problem

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.