For showing the image in UIImageView to fit in the frame from centre, set two properties of UIImageView.
1.) UIViewContentMode:
[self.myImageView setContentMode:UIViewContentModeScaleAspectFill];
- This will make image to be maintain its original width and height ratio.(Aspect)
2.) clipsToBounds
[self.myImageView setClipsToBounds:YES];
- This will clip the image part which is going outside the UIImageView's frame.
So both UIViewContentMode and clipsToBounds will make the image to crop from the centre and will maintain the original width and height ratio of image.
thanks!!
ReplyDeleteperfect!! thanks
ReplyDeleteWorking fine
ReplyDelete