<分区>
Possible Duplicate:
drawing UIImage inside a CGMutablePath
我的 drawRect 中有一条路径,如下所示:
CGContextSetLineWidth(context, 1.5);
CGContextSetStrokeColorWithColor(context, [UIColor whiteColor].CGColor);
CGContextAddEllipseInRect(context, rect);
CGContextStrokePath(context);
CGContextClip(context);
CGContextTranslateCTM(context, 0.0, rect.size.height);
CGContextScaleCTM(context, 1.0, -1.0);
CGContextDrawImage(context, rect, self.image_.CGImage);
UIGraphicsBeginImageContext(rect.size);
UIImage * circleUserProfile = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
[circleUserProfile drawAtPoint:CGPointMake(0, 0)];
CGContextRestoreGState(context);
我有一个 UIImage,我想让 UIImage 夹在这个圆圈内。上面的代码似乎在做我之前问过的here ,但仍然不起作用。这是为什么?