Skip to content

Instantly share code, notes, and snippets.

@yuanhao
Created January 4, 2015 12:09
Show Gist options
  • Select an option

  • Save yuanhao/71049b329af0baae2a62 to your computer and use it in GitHub Desktop.

Select an option

Save yuanhao/71049b329af0baae2a62 to your computer and use it in GitHub Desktop.
+ (UIImage*)imageWithImage:(UIImage*)image
scaledToSize:(CGSize)newSize;
{
UIGraphicsBeginImageContext( newSize );
[image drawInRect:CGRectMake(0,0,newSize.width,newSize.height)];
UIImage* newImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return newImage;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment