I'm using UIGestureRecognizers to rotate and resize an image using uiimageview. Now problem is that I need to get the new size of the image from UIImageView transform (which is CGAffineTransform) property. I found this code at StackOverFlow, but it is not returning proper values. As imageview is not only resized but also rotated. So my question is how to get the new size and location from the rotated and resized UIImageView's transform property?
CGRect newRect = CGRectApplyAffineTransform(self.imageView.bounds, self.imageView.transform);
Anyone can help?
Thanks
ANSWER OK, I found a fix. The main thing creating the problem in size calculation was the rotation. So what a did check it here.
CGFloat angle = atan2(self.imageView.transform.b, self.imageView.transform.a);
CGAffineTransform tempTransform = CGAffineTransformRotate(self.imageView.transform, -angle);
CGRect newRect = CGRectApplyAffineTransform(CGRectMake(0, 0, self.imageView.image.size.width, self.imageView.image.size.height), tempTransform);
Thanks everybody