ios - UIScreen.mainScreen().bounds 始终为零

标签 ios swift

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

最佳答案

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

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

关于ios - UIScreen.mainScreen().bounds 始终为零,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27591904/

相关文章:

ios - 呈现 View 时,VoiceOver 不会始终关注 UILabel

ios - 向 UIImagepickercontroller 导航栏添加后退按钮

ios - 一个应用程序中的两个 RCTRootView 实例

json - 如何在 Swift 3 中用 Alamofire 4 解析这个 json?

ios - Firebase crashlytics 没有告诉我 swift 的确切崩溃问题

ios - 无法将 AVCaptureVideoDataOutputSampleBufferDelegate 实现为自身

ios - 3 我不确定的泄漏?

ios - 如何在 native react 中获取更新的设备 token ?

iOS,快。如何使用这样的下拉列表制作 float 搜索栏? (包括图像)

swift - 在 Swift 中将 UITextField 转换为字符串