如何获取uiimage的高度和宽度? [英] How can I get the height and width of an uiimage?

查看:77
本文介绍了如何获取uiimage的高度和宽度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从URL 邮件

我正在将图像添加到邮件视图.它将显示完整图像.但是我要计算,按比例更改图像的高度和宽度.

I'm adding image to mail view. It will show full image. But I want to calculate, proportionally change the height and width of the image.

如何获取 UIImage 的高度和宽度?

How can I get the height and width of UIImage?

推荐答案

let heightInPoints = image.size.height
let heightInPixels = heightInPoints * image.scale

let widthInPoints = image.size.width
let widthInPixels = widthInPoints * image.scale

这篇关于如何获取uiimage的高度和宽度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆