iOS - CGContextRotateCTM上的上下文无效

时间:2014-12-15 08:44:31

标签: ios objective-c cgcontextref

当我尝试运行我的旋转方法时,我收到以下错误:

<Error>: CGContextRotateCTM: invalid context 0x0. This is a serious error. This application, or a library it uses, is using an invalid context and is thereby contributing to an overall degradation of system stability and reliability. This notice is a courtesy: please fix this problem. It will become a fatal error in an upcoming update.

旋转方法:

&#13;
&#13;
UIImage* rotate(UIImage* src, double degrees) {
    UIGraphicsBeginImageContext(src.size);
    CGContextRef context = UIGraphicsGetCurrentContext();
    CGContextRotateCTM (context, radians(degrees));
    [src drawAtPoint:CGPointMake(0, 0)];
    UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    return image;
}
&#13;
&#13;
&#13;

你知道我做错了什么吗?

1 个答案:

答案 0 :(得分:0)

图片为零

OR

它的大小为零。 =&GT;空图像