How to detect iPhone 5 screen in iOS 8

100 views Asked by At

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?

2

There are 2 answers

1
Ptah On BEST ANSWER

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")){ 
   ...
}
2
Anuj Rajput On

What I understood is that this what you want to do

You need to do add a LaunchScreen.xib for your App to be compatible on iOS 8 If you are supporting iOS <8 you must add a iPhone 5 resolution (640x1136) sized black PNG file named [email protected]

This is how Apple recommends to add a LaunchScreen.xib https://developer.apple.com/library/ios/documentation/IDEs/Conceptual/AppDistributionGuide/ConfiguringYourApp/ConfiguringYourApp.html#//apple_ref/doc/uid/TP40012582-CH28-SW4