I am a beginner in iOS development and stuck at the following problem.
In .xib file I have button and imageview as displayed in following image.
Now I did the following to show image in image view and set content mode in .m file.
UIImage *save = UIGraphicsGetImageFromCurrentImageContext();
self.ivCard.image = save;
self.ivCard.contentMode = UIViewContentModeScaleAspectFit;
self.ivCard.clipsToBounds = YES;
Now the result looks like the following image.
The original image has resolution of 2000x1000, here it is
The image is automatically cropped from the right side, it should be fit with image view.