xcode 4.5 how to pick storyboards at launch

前端 未结 5 1720
灰色年华
灰色年华 2020-11-29 16:49

Trying to make my app work with both iPhone 5 and iPhone 4/4s. I tried the \"AutoLayout\" but does not seem to work for my app also read that it is not supported in iOS 5.

5条回答
  •  孤城傲影
    2020-11-29 17:18

    Currently the only way is to check if you're using the iPhone 5 is the [UIScreen mainScreen] bounds] and [[UIScreen mainScreen] scale].

    BOOL isIphone5 = (([[UIDevice currentDevice] userInterfaceIdiom] 
    == UIUserInterfaceIdiomPhone) && (([UIScreen mainScreen].bounds.size.height * 
    [[UIScreen mainScreen] scale]) >= 1136));
    

    This only works if you have at least added a Default-568h@2x.png launch image to your application. Else this will always return false. (Because the screen will be letterboxed if you don't have the launch image)

    To set the storyboard to your iPhone 5 version you might want to take a look at this question

提交回复
热议问题