I noticed something weird: if I delete all launch images/storyboards from an iOS app project, then UIScreen.main.bounds
shrink to 320x480, regardless of an actual screen size.
My question is: do I need a launch image/storyboard to make sure that the size of the main screen is correct?
Here is a code sample:
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
let screenBounds = UIScreen.main.bounds
print(String(describing: screenBounds)) // Prints "(0.0, 0.0, 320.0, 480.0)"
window = UIWindow(frame:screenBounds)
window!.rootViewController = MyViewController()
window!.makeKeyAndVisible()
return true
}
}
And here is my simulator's screen (iPhone 8 plus, iOS 11.2):