Search code examples
iosios8xibscreen-resolutioniphone-5

How to detect iPhone 5 screen in iOS 8


I have a game which is adapted to iPhone 4 & iPhone 5 screens. Everything worked well on iOS 7, but on the iOS8 when I build the project for iPhone 5 with iOS 8 shows iphone4.xib's with black stripe, this means that it does not detect iPhone 5 screen. How to fix this?


Solution

  • I solved the problem.

    Before that, I checked which device the app is running in by: [VSUtils isIPhone5Screen]. On iOS8 it doesn't work.

    I have done so:

    #define SYSTEM_VERSION_EQUAL_TO(v)                  ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedSame)
    #define SYSTEM_VERSION_GREATER_THAN(v)              ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedDescending)
    #define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v)  ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)
    #define SYSTEM_VERSION_LESS_THAN(v)                 ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending)
    #define SYSTEM_VERSION_LESS_THAN_OR_EQUAL_TO(v)     ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedDescending)
    
    if(SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"7.0")){ 
       ...
    }