在UIImageView中获得缩放的UIImage的大小,可以通过以下步骤实现:
let imageViewWidth = imageView.frame.size.width
let imageViewHeight = imageView.frame.size.height
let imageSize = imageView.image?.size
let scaleWidth = imageViewWidth / imageSize.width
let scaleHeight = imageViewHeight / imageSize.height
let scaledImageWidth = imageSize.width * scaleWidth
let scaledImageHeight = imageSize.height * scaleHeight
print("Scaled Image Size: (\(scaledImageWidth), \(scaledImageHeight))")
这样,你就可以在UIImageView中获得缩放的UIImage的大小了。
领取专属 10元无门槛券
手把手带您无忧上云