The UIImage
class can be used to represent an image. The following snippet scales
an image according to a size which is provided with a CGSize parameter.
+ (UIImage *)scale:(UIImage *)image toSize:(CGSize)size
{
UIGraphicsBeginImageContext(size);
[image drawInRect:CGRectMake(0, 0, size.width, size.height)];
UIImage *scaledImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return
scaledImage;
}
No comments:
Post a Comment