如何获得iOS设备屏幕的高度和宽度 [英] How to get iOS device screen height and width
本文介绍了如何获得iOS设备屏幕的高度和宽度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
考虑各种iOS设备和方向,获取当前屏幕分辨率的最简单方法是什么,包括高度和宽度?
Accounting for the various iOS devices and orientations, what is the simplest approach to getting the current screen resolution, including height and width?
推荐答案
UIScreen
是您的朋友。
UIScreen
is your friend here.
CGRect screenRect = [[UIScreen mainScreen] bounds];
CGFloat screenWidth = screenRect.size.width;
CGFloat screenHeight = screenRect.size.height;
这篇关于如何获得iOS设备屏幕的高度和宽度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文