Reputation: 5259
I am running my code on iphone 6 device, on portrait mode.
NSLog(@"main screen height : %f", [UIScreen mainScreen].bounds.size.height);
Why does it return 568.0 and not 667.0?
Mode on iPhone is Standard - not Zoomed.
EDIT : This happens even on simulator - when I choose device to be iphone 6.
Upvotes: 5
Views: 2960
Reputation: 71
Janmenjaya‘s answer is right,but not complete in some cases. After what Janmenjaya suggest to do,go to TARGETS->General->App Icons and Launch Images->Launch Images Source ,then choose the launch image name.Next time run the project ,the height will be right.
Upvotes: 0
Reputation: 926
Launch images are still necessary if you need to continue to support iOS 7, otherwise the resizable launch screen (storyboard) is the way to go.
Upvotes: 0
Reputation: 4163
Add the splash image for iPhone 6, then it will work as you want
Click on images.xcassets, click on attribute inspector and choose iOS 8.0 and Later
then you will get option for two extra launch image like below Drag drop the retina size image for iPhone 6 and iPhone 6 plus in Retina HD 4.7 and Retina HD 5.5 respectively
Upvotes: 9
Reputation: 2459
Launch Images are outdated. Add a single resizable Launch Screen and you will always get native resolution in iOS 8 (which is oldest OS the iPhone 6 will run anyway).
Go to File > New > File > iOS User Interface > Launch Screen.
Make a Storyboard launch screen. This will work for any sized screen, present or future.
Go to the "General" tab for your app target. In the "App Icons and Launch Images" section, choose the Launch Screen File you just made.
Upvotes: 1