Skip to content
This repository has been archived by the owner on Jan 16, 2021. It is now read-only.

Commit

Permalink
When comparing the size of the image and the imageview's size. The or…
Browse files Browse the repository at this point in the history
…igin 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.
  • Loading branch information
jeroenleenarts committed Sep 4, 2015
1 parent 8767f4d commit 6f3aef9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ParseUI/Classes/Cells/PFCollectionViewCell.m
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 6f3aef9

Please sign in to comment.