美文网首页
iOS获取像素 获取屏幕像素

iOS获取像素 获取屏幕像素

作者: Dolway | 来源:发表于2022-02-28 17:59 被阅读0次

iOS获取的宽高都默认是point。 但是有时候我们想获取具体的像素,当然我们可以用point 乘以倍数。

不过获取屏幕的像素有更简单的方法:

[[UIScreen mainScreen] currentMode]

UIScreenMode:只有两个仅读属性
@property(readonly,nonatomic) CGSize  size;             
// The width and height in pixels


@property(readonly,nonatomic) CGFloat pixelAspectRatio; 
// The aspect ratio of a single pixel. The ratio is defined as X/Y.

相关文章

网友评论

      本文标题:iOS获取像素 获取屏幕像素

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