From 6f3aef951ada7e2c11361ac9ba28c5d8bc993211 Mon Sep 17 00:00:00 2001 From: Jeroen Leenarts Date: Fri, 4 Sep 2015 20:51:09 +0200 Subject: [PATCH] When comparing the size of the image and the imageview's size. The origin of the image view should not be considered. I have noticed that when positioning a imageView in a cell on another location unintended behavior occurs due to the fact that even though the image could be contained within the bounds of the imageview, the CGContainsRect call "fails" because the origin places one or more corners of the imageview frame outside of the generated imageView rect. --- ParseUI/Classes/Cells/PFCollectionViewCell.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ParseUI/Classes/Cells/PFCollectionViewCell.m b/ParseUI/Classes/Cells/PFCollectionViewCell.m index 6207b11..6fb1f46 100644 --- a/ParseUI/Classes/Cells/PFCollectionViewCell.m +++ b/ParseUI/Classes/Cells/PFCollectionViewCell.m @@ -56,7 +56,7 @@ - (void)layoutSubviews { // Adapt content mode of _imageView to fit the image in bounds if the layout frame is smaller or center if it's bigger. if (!CGRectIsEmpty(imageViewFrame)) { - if (CGRectContainsRect(PFRectMakeWithSize(_imageView.image.size), imageViewFrame)) { + if (CGRectContainsRect(PFRectMakeWithSize(_imageView.image.size), PFRectMakeWithSize(imageViewFrame.size))) { _imageView.contentMode = UIViewContentModeScaleAspectFit; } else { _imageView.contentMode = UIViewContentModeCenter;