如何在 iOS 中使用 MApkit 在地图中的注释上创建一个圆圈覆盖?

How to create a circle overlay over my annotation in Maps using MApkit in iOS?

我想在注释上创建一个圆圈覆盖。我正在使用 swift 3.0。感谢您的帮助!!

试试自定义叠加层。在 viewDidLoad 中添加:

MKCircle *circle = [MKCircle circleWithCenterCoordinate:userLocation.coordinate radius:1000];
[map addOverlay:circle];

userLocation 可以通过将 MKUserLocationAnnotation 存储为 属性 来获得。然后,要真正绘制圆圈,请将其放入地图视图的委托中:

- (MKOverlayRenderer *)mapView:(MKMapView *)map viewForOverlay:(id <MKOverlay>)overlay
{
    MKCircleRenderer *circleView = [[MKCircleRenderer alloc] initWithOverlay:overlay];
    circleView.strokeColor = [UIColor redColor];
    circleView.fillColor = [[UIColor redColor] colorWithAlphaComponent:0.4];
    return circleView;
}