我试图为 MapView 的覆盖视图描边并填充路径。现在填充工作,笔画不...从下面的代码看有什么想法吗?
- (void)drawMapRect:(MKMapRect)mapRect
zoomScale:(MKZoomScale)zoomScale
inContext:(CGContextRef)ctx
{
CGContextSetRGBStrokeColor(ctx, 1.0, 0.0, 0.0, 0.8);
CGContextSetRGBFillColor(ctx, 0.0, 0.0, 0.8, 0.4);
CGContextSetLineCap(ctx, kCGLineCapRound);
CGContextSetLineWidth(ctx, 8.0);
CGPoint pt;
pt = [self pointForMapPoint:MKMapPointForCoordinate(CLLocationCoordinate2DMake(0, 0))];
CGContextMoveToPoint(ctx, pt.x, pt.y);
pt = [self pointForMapPoint:MKMapPointForCoordinate(CLLocationCoordinate2DMake(-2, 3))];
CGContextAddLineToPoint(ctx, pt.x, pt.y);
pt = [self pointForMapPoint:MKMapPointForCoordinate(CLLocationCoordinate2DMake(-2, 5))];
CGContextAddLineToPoint(ctx, pt.x, pt.y);
pt = [self pointForMapPoint:MKMapPointForCoordinate(CLLocationCoordinate2DMake(-4, 4))];
CGContextAddLineToPoint(ctx, pt.x, pt.y);
CGContextDrawPath(ctx, kCGPathFillStroke);
}