Last active
January 24, 2023 04:24
-
-
Save l4u/9440f62bb3ed0bb880a6 to your computer and use it in GitHub Desktop.
Create a UIWindow programmatically without using storyboards in swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window = UIWindow(frame: UIScreen.mainScreen().bounds) | |
if let window = window { | |
window.backgroundColor = UIColor.whiteColor() | |
window.rootViewController = UIViewController() | |
window.makeKeyAndVisible() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here
mainScreen bounds works and window adjusts according to size when switched landscape or portrait automatically. This is perfect.
Question: But, why doesn't it adpat automatically with in a UIViewController for its sub components ?