Rect size for image size based imageView iOS swift
Solution:
extension UIImageView {
var contentClippRect: CGRect {
var imageRect:CGRect!
let scaleX = bounds.size.width/image!.size.
let scaleY = bounds.size.height/image!.size
if scaleX < scaleY {
imageRect = CGRect(x: 0, y: (bounds.size.height - scaleX*image!.size.heigh
}
else {
imageRect = CGRect(x:(bounds.size.width-scaleY*image!.size.width)*
}
return imageRect
}
}
Comments
Post a Comment