Skip to content

Commit

Permalink
Working around microsoft#1965 in UIImageSetLayerContents.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredhms committed Feb 14, 2017
1 parent 8f667c3 commit 56857f0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Frameworks/UIKit/UIImage.mm
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ void UIImageSetLayerContents(CALayer* layer, UIImage* image) {
if ([layer contentsOrientation] != [image imageOrientation]) {
[layer setContentsOrientation:[image imageOrientation]];
}
CGRect stretch = [image _imageStretch];

// Working around #1965; only call '_imageStretch' if 'image' is non-nil
CGRect stretch = (image ? [image _imageStretch] : CGRectZero);
if (!CGRectEqualToRect([layer contentsCenter], stretch)) {
[layer setContentsCenter:stretch];
}
Expand Down

0 comments on commit 56857f0

Please sign in to comment.