UIScreen.mainScreen().bounds 始终为零



我正在尝试获取屏幕宽度以在iPhone 6上显示不同的图像。但是,当我检查宽度或高度时,UIScreen.mainScreen().bounds始终为零。知道为什么吗?

let height = UIScreen.mainScreen().bounds.height
let width = UIScreen.mainScreen().bounds.width

最新更新