如何在地图上填写iOS 7中的外部叠加圈

我需要地图上的圆圈周围填充空间与iOS7中的“提醒”应用程序相同。 我认为需要使用方法applyFillPropertiesToContext:atZoomScalefillPath:inContext: .

iOS 7提醒

我解决了我的问题:

 - (void)drawMapRect:(MKMapRect)mapRect zoomScale:(MKZoomScale)zoomScale inContext:(CGContextRef)context { // Fill full map rect with some color. CGRect rect = [self rectForMapRect:mapRect]; CGContextSaveGState(context); CGContextAddRect(context, rect); CGContextSetFillColorWithColor(context, [UIColor colorWithWhite:0.0 alpha:0.4f].CGColor); CGContextFillRect(context, rect); CGContextRestoreGState(context); // Clip rounded hole. CGContextSaveGState(context); CGContextSetFillColorWithColor(context, [UIColor whiteColor].CGColor); CGContextSetBlendMode(context, kCGBlendModeClear); CGContextFillEllipseInRect(context, [self rectForMapRect:[self.overlay boundingMapRect]]); CGContextRestoreGState(context); // Draw circle [super drawMapRect:mapRect zoomScale:zoomScale inContext:context]; }