1

I know there is some questions like this but i got no solution. I am trying to understand if it is iPhone 6 or not.

#define IS_IPHONE_5 (IS_IPHONE && [[UIScreen mainScreen] bounds].size.height == 568.0)
#define IS_IPHONE_6 (IS_IPHONE && [[UIScreen mainScreen] bounds].size.height == 667.0)

When i try this it return IS_IPHONE_5 is true even in iPhone 6. If i try native.scale iphone 5 and 6 also return 2, only iphone 6 plus returns 3. So i cant get it if it is iphone 6 from height or from scale.

 NSStringFromCGRect(mainScreen.bounds), mainScreen.coordinateSpace, mainScreen.scale, mainScreen.nativeScale); 

They are all return same in iPhone 5 and iPhone 6. So how to detect it? any help please.

Yucel Bayram
  • 1,653
  • 2
  • 22
  • 41
  • Why would you detect the iPhone the app is running on? There is no need, you can use AutoResizemask or auotlayout to fix your UI correctly. – rckoenes Nov 10 '14 at 15:51
  • 1
    See http://stackoverflow.com/questions/25754942/how-to-enable-native-resolution-for-apps-on-iphone-6-and-6-plus – rmaddy Nov 10 '14 at 15:52
  • 1
    What exactly you want to accomplish detecting the user's device. Maybe your are following the wrong approach for your app. – David Gomez Nov 10 '14 at 15:56
  • 3
    Why is the SO community so heavy handed all the time? I've up-voted you back up to zero... I'm not sure why you would want to detect the iPhone version, but just because I can't fathom a reason you might want doesn't mean I should righteously declare that you should *never* do it and slap you on the wrist. What people are saying is valid. The linked question above will probably lead you to the answer you are looking for. – dave Nov 10 '14 at 16:03
  • @dave It is fine you downvoted or upvoted. I m working on old project which i did not write. Code is completely mess and if i could detect iphone model i could easly change size of background view. There is no xib or storyboard. Everything created programatically. – Yucel Bayram Nov 11 '14 at 07:22

1 Answers1

1

In order to support native resolution on iPhone 6/6+ you need to either

  • provide properly sized launch images
  • provide XIB file for launch screen
sha
  • 17,824
  • 5
  • 63
  • 98