Andrew Duncan
Andrew Duncan

Reputation: 3753

Why is iPhone 8 screen size reported as 320x480?

I have inherited an app that uses separate Storyboards for iPhone and iPad. Neither uses autolayout. In viewDidLoad() I log the value of UIScreen.main.bounds.

For any iPhone (5s through X) the logged size is 320x480. This does not change after viewDidLayoutSubviews().

When I create an app from scratch, I get the expected sizes (e.g. 375x667 for iPhone 6 thru 8).

What could be different in my hand-me-down app that makes the screen size uniformly the ancient values for 1x iPhones?

Please note this has nothing to do with view resizing -- this is the screen we are talking about. Similarly the screen scale plays no apparent role.

Upvotes: 0

Views: 1640

Answers (1)

Brandon
Brandon

Reputation: 23500

When you create a new project, if it comes with a Storyboard for Launch images, the size will be automatically detected..

However, for older projects that uses Image Assets instead, you need to provide sizes for the launch screen. IE: "Default" images of the correct sizes of the screen as per:

https://developer.apple.com/ios/human-interface-guidelines/icons-and-images/launch-screen/

Static Launch Screen Images. The names shall be: "[email protected]"

where XXX is the height and Y is the resolution.. Example:

Upvotes: 2

Related Questions