Reputation: 99
I want to create a circle overlay over the annotation. I'm using swift 3.0. Any help is appreciated !!
Upvotes: 0
Views: 312
Reputation: 2672
Try a custom overlay. Add this in viewDidLoad
:
MKCircle *circle = [MKCircle circleWithCenterCoordinate:userLocation.coordinate radius:1000];
[map addOverlay:circle];
userLocation
can be obtained by storing the MKUserLocationAnnotation
as a property. Then, to actually draw the circle, put this in the map view's delegate:
- (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;
}
Upvotes: 1