Naming convention for iPhone 5 images?

前端 未结 1 955
一向
一向 2020-12-07 05:14

I am working on an app that would be for iPhone 5 and lower.

for images I am using this code

CGRect mainFrame = [[UIScreen mainScreen] bounds];

int         


        
相关标签:
1条回答
  • 2020-12-07 05:50

    Default-568h@2x.png this would be the launch image you need, you need to add -568h@2x to the end of all your iPhone 5 images, but there have been issues with the naming convention.

    I found doing it like this has helped.

       [pBackgroundImageView setImage:[UIImage imageNamed:(IS_PHONE5()) ? @"myimage-568h@2x.png" : @"myimage.png"]];
    

    The issue is it doesn't pick the -568h@2x up but this is the way it should be. to get the IS_PHONE5 variable add

       #define IS_PHONE5() ([UIScreen mainScreen].bounds.size.height == 568.0f && [UIScreen mainScreen].scale == 2.f && UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
    

    Thought this may help anyone wondering about supporting high resolution phones and iPhone 5

    Supporting high resolution and iPhone 5

    0 讨论(0)
提交回复
热议问题