Reputation: 16813
I am using UICollectionView where cell's are almost square, but original image is rectangle. Therefore, when I display image as follows, it is getting cut.
Is there a way to handle this issue?
I am currently working on Objective-C but I am to see Swift solution as well.
cell.productImage content mode is Aspect Fill
cell.productImage.image = [cell.productImage.image imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
Upvotes: 1
Views: 467
Reputation: 2430
Please add this line to your code.
cell.productImage.contentMode = .scaleAspectFit
Upvotes: 2