Search code examples
iosobjective-cuiimageviewuiimagebounds

Get dimension or CGRect of UIImage after AspectFit


I am just finding the way to get the image size whenever it aspect fit to imageview. but didn't get any proper way to get the image dimension. enter image description here I just want to calculate the difference between the imageview and the actual image in the imageview. Please advice.


Solution

  • Actually, when the image is showed, its size(instance of Image) doesn't change unless you call compressing image functions.

    The only problem is how it's drawn on ImageView. When you use aspect fit to imageview, the image is drawn keeping its own rate between width and height based on the larger one of width and height of ImageView.

    So, how to calculate the drawn image size is showed above by @Luan Tran.

    Thanks

    Hope it help