Search code examples
ioscgrect

How to get absolute rect on screen of UIImageView


I need to resize an UImageView dynamically

for that I need to find the UImageview's absolute rect on screen, x,y is what i need actually.

because my ImageView is inside another view, if i query the ImageView frame, i get x,y of it to be 0,0

how do I find the absolute rect on screen ?


Solution

  • try using

    CGRect targetFrame = [self.view convertRect:imageView.frame fromView:imageView];