Swift 获取Image在当前ImageView 中的坐标

Swift 获取Image在当前ImageView 中的坐标,第1张

需要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)

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/langs/564545.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-04-06
下一篇 2022-04-06

发表评论

登录后才能评论

评论列表(0条)

保存