Skip to content

Commit

Permalink
Center image when aspect ratio of source doesn't match desired ratio
Browse files Browse the repository at this point in the history
  • Loading branch information
Justin DeVries committed Apr 13, 2011
1 parent d2b6abd commit ca41381
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Classes/UIImage+ProportionalFill.m
Expand Up @@ -107,7 +107,7 @@ - (UIImage *)imageToFitSize:(CGSize)fitSize method:(MGImageResizingMethod)resize
targetWidth / scaleFactor, targetHeight / scaleFactor);
} else {
sourceRect = CGRectMake(0, 0, sourceWidth, sourceHeight);
destRect = CGRectMake(0, 0, scaledWidth, scaledHeight);
destRect = CGRectMake((targetWidth - scaledWidth) / 2.0, (targetHeight - scaledHeight) / 2.0, scaledWidth, scaledHeight);
}

// Create appropriately modified image.
Expand Down

0 comments on commit ca41381

Please sign in to comment.