Rect size for image size based image iOS Objective C
Solution: - ( CGRect ) contentClippingRect :( U IImageView *)img { CGRect imageRect; CGFloat scaleX = img. bounds . size . width /img. imag e . size . width ; CGFloat scaleY = img. bounds . size . height /img. ima ge . size . height ; if (scaleX < scaleY) { imageRect = CGRectMake ( 0 , (img. bounds . size . height - scaleX*img. image . size . he ight )* 0.5f , img. bounds . size . width , scaleX*img. image . size . he ight ); } else { imageRect = CGRectMake ((img. bounds . size . wi dth -scaleY*img. image . siz e . width )* 0.5 , 0 , scaleY*img. image . size . wi dth , aspectRatioX*img. image . size . he ight ); } return imageRect; }