Mark Yang
Mark Yang

Reputation: 344

[UIScreen mainScreen].bounds returns wrong width,height

Trying to port iPad app to iPhone. When I set device type to iPhone and execute below

[[UIScreen mainScreen] bounds]

returns width,height (480,320) even in iPhone 6+. but when I create new clean project for iPhone 6+ it returns (736,414).right coordinate. How can I fix it ?

Upvotes: 1

Views: 1459

Answers (1)

Mark Yang
Mark Yang

Reputation: 344

I find way based on comments..thanks. iPhone app seems to decide resolution based on Launch Screen !! Long time ago. Launch Screen was just image files for each devices. But now it was replace with 'Launch Screen.storyboard' file. If you app don't have file..it works very oddly. So App should have Launch Screen file..

New File -> iOS(Interface) -> Launch Screen

and

Link this file to your project

TARGETS -> General -> App Icons and Launch Image -> Launch Screen File

Type newly created file name manually (Launch Screen.storyboard)

Done !!

Upvotes: 2

Related Questions