Created
January 2, 2013 12:01
-
-
Save jlcampana/4434083 to your computer and use it in GitHub Desktop.
Cambiar aspect ratio para fotos según pantalla
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CGSize s = originalImage.size; | |
CGSize s2 = [UIScreen mainScreen].bounds.size; | |
CGSize s3 = CGSizeMake(roundf(s.width / s2.width), roundf(s.height/s2.height)); | |
CGFloat factor = fmax(s3.width, s3.height); | |
// Divide the size by the greater of the vertical or horizontal shrinkage factor | |
s.width = roundf(s.width /factor); | |
s.height = roundf (s.height / factor); | |
UIImage *image = [self scaleImage:originalImage ToSize:s]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment