Reputation: 419
i have created universal project using Xcode 5. Now how can I run those project in Xcode 6. Also want to upgrade for iPhone 6 and iPhone 6 plus.
#define IS_IPHONE (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
#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)
//#define IS_IPHONE_6PLUS (IS_IPHONE && [[UIScreen mainScreen] nativeScale] == 3.0f)
#define IS_IPHONE_6_PLUS (IS_IPHONE && [[UIScreen mainScreen] bounds].size.height == 736.0)
Upvotes: 0
Views: 576
Reputation: 52565
As Jorn says, don't work with specific size screens. It should be pretty obvious given recent events that Apple no longer feel constrained by a small number of screen sizes.
To make your app work on iPhone 6 and 6+, you need to add a Launch Screen file, either a XIB or a storyboard that looks like your first screen (or a splash screen). Much like the iPhone 5-size image tells Xcode that your app supports the iPhone 5, the launch screen tells Xcode that your app has been updated for the most recent phones.
Note that you might also need to make other changes. The iOS 8 SDK has plenty of changes others than the screen sizes.
Upvotes: 0
Reputation: 1044
Do not base your code on screen resolution. Available features should be detected by respondsToSelector:
, UI should be done using auto layout and if you need to do some customization for certain sizes, use the size class control in Xcode. If you need to do this in code, use willTransitionToTraitCollection(:withTransitionCoordinator:)
to find out which size class that will appear.
See Apple's introduction to size classes here
Upvotes: 2