美文网首页
Swift 获取App显示的尺寸

Swift 获取App显示的尺寸

作者: CYC666 | 来源:发表于2023-05-07 09:20 被阅读0次

情况一:【全屏】
宽度 = UIScreen.main.bounds.width
高度 = UIScreen.main.bounds.height

情况二:【非全屏】【iPad的分屏、侧拉模式】
let window = UIApplication.shared.windows.first(where: { $0.isKeyWindow })
宽度 = window.bounds.size.width
高度 = window.bounds.size.height

相关文章

网友评论

      本文标题:Swift 获取App显示的尺寸

      本文链接:https://www.haomeiwen.com/subject/kluhsdtx.html