我旋转我的图像:
UIImage *image = [UIImage imageNamed:@"doneBtn.png"];
CGImageRef imgRef = image.CGImage;
CGFloat width = CGImageGetWidth(imgRef);
CGFloat height = CGImageGetHeight(imgRef);
CGAffineTransform transform = CGAffineTransformIdentity;
CGRect bounds = CGRectMake(0, 0, width, height);
transform = CGAffineTransformRotate(transform, degreesToRadians(10));
UIGraphicsBeginImageContext(bounds.size);
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextConcatCTM(context, transform);
CGContextDrawImage(UIGraphicsGetCurrentContext(), CGRectMake(0,0,width,height), imgRef);
UIImage *imageCopy = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
img.image=imageCopy;
当我显示图像时,我在 10 度以下看到它,但图像在边缘被切断。
有人知道如何解决这个问题吗?这是用于澄清的图像。
替代文字 http://img197.imageshack.us/img197/7077/problemkfr.png
我昨天一直在尝试一整天,但无法弄清楚。
另一个示例图像: