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.
Pretty sure you didn't add constraints to the ImageView, the ImageView size it's not the same as the device size.
Add constraints from the ImageView to the borders in the Interface Builder, and it will work.