看看这段代码:
- (void)drawRect:(CGRect)rect
{
[super drawRect:rect];
CGContextRef context = UIGraphicsGetCurrentContext();
CGSize myShadowOffset = CGSizeMake (-10, 15);
CGContextSaveGState(context);
CGContextSetShadow (context, myShadowOffset, 5);
CGContextSetLineWidth(context, 4.0);
CGContextSetStrokeColorWithColor(context,
[UIColor blueColor].CGColor);
CGRect rectangle = CGRectMake(60,170,200,200);
CGContextAddEllipseInRect(context, rectangle);
CGContextStrokePath(context);
CGContextRestoreGState(context);
}
Run Code Online (Sandbox Code Playgroud)
它所做的就是为这个圆圈绘制一个圆圈和一个阴影。但是我想不通如何只画阴影而不画圆圈?我怎么做?SO上类似问题的答案对我没有帮助