需要AVKit框架
import AVKit
let image1 = UIImage(named: "image1")
let rect1 = AVMakeRect(aspectRatio: image1?.size ?? .zero, insideRect: imageView1.bounds);
print("imageView frame:", imageView1.frame)
print("image rect:", rect1)
打印结果
imageView frame: (20.0, 144.0, 300.0, 200.0)
image rect: (87.7431906614786, 0.0, 124.5136186770428, 200.0)
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)