9/12/2011

UIImageを指定サイズにリサイズするSnippet


- (UIImage *)resizeImage:(UIImage *)image width:(CGFloat)width height:(CGFloat)height{
UIImage *returnImage = nil; //リサイズ後のUIImage
UIGraphicsBeginImageContext(CGSizeMake(width, height));
[image drawInRect:CGRectMake(0, 0, width, height)];
returnImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return returnImage;
}

0 件のコメント:

コメントを投稿