0
下面是我的代碼,但它崩潰了...有什麼想法?如何放大和裁剪UIImage?
UIImage *tempImage = [[UIImage alloc] initWithData:imageData];
CGImageRef imgRef = [tempImage CGImage];
[tempImage release];
CGFloat width = CGImageGetWidth(imgRef);
CGFloat height = CGImageGetHeight(imgRef);
CGRect bounds = CGRectMake(0, 0, width, height);
CGSize size = bounds.size;
CGAffineTransform transform = CGAffineTransformMakeScale(4.0, 4.0);
UIGraphicsBeginImageContext(size);
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextConcatCTM(context, transform);
CGContextDrawImage(context, bounds, imgRef);
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
我在這裏錯過了什麼?基本上只是試圖縮放圖像,並將其裁剪成與原始大小相同。
感謝
哪一種崩潰的?什麼是錯誤信息?什麼線路導致崩潰? – vodkhang 2010-09-04 05:13:16