1

到目前为止,我没有太多代码,只有这个开始:

UIGraphicsBeginImageContextWithOptions(bounds.size, NO, 0);

    CGContextRef context = UIGraphicsGetCurrentContext();
CGMutablePathRef outerPath;

CGMutablePathRef highlightPath;

CGRect outerRect = rectForRectWithInset(bounds, 1); 

CGRect highlightRect = CGRectMake(outerRect.origin.x,
                                      outerRect.origin.y + 1,
                                      outerRect.size.width,
                                      outerRect.size.height);

然后是有问题的位,当被注释掉时,错误就消失了:

CGContextSaveGState(context);

CGContextAddPath(context, highlightPath);
CGContextSetFillColorWithColor(context, [[UIColor colorWithWhite:1.0 alpha:0.05]CGColor]);
CGContextFillPath(context);

CGContextRestoreGState(context);

下面是简单的:

UIImage *image = UIGraphicsGetImageFromCurrentImageContext();

    UIGraphicsEndImageContext();
4

1 回答 1

1

似乎边界 0,0,0,0 或 highlightPath 有问题。这些价值观从何而来?

于 2012-07-10T21:12:46.967 回答