How to Draw circle around current Location like city mapper. (iOS 8 -Objective C)

2.5k views Asked by At

I have a app which tag locations. I have successfully added pins to the Mapview. But i have no idea how to draw circle of radius 100 meters start from my current location and How to make it move with current location. [iOS 8 Objective-C] [Circle like city Mapper App!]1

1

There are 1 answers

0
GetMe4GetMe On BEST ANSWER

Finally i have managed to create Circle.

MKCircle *circleoverlay = [MKCircle circleWithCenterCoordinate:mapView.userLocation.coordinate radius:100];
[circleoverlay setTitle:@"Circle"];
[mapView addOverlay:circleoverlay];

and than Rendering

 - (MKOverlayRenderer *) mapView:(MKMapView *)mapView rendererForOverlay:(id)overlay
{ if([overlay isKindOfClass:[MKCircle class]])
    {
        MKCircleRenderer* aRenderer = [[MKCircleRenderer
                                        alloc]initWithCircle:(MKCircle *)overlay];

        aRenderer.fillColor = [[UIColor blueColor] colorWithAlphaComponent:0.0];
        aRenderer.strokeColor = [[UIColor grayColor] colorWithAlphaComponent:0.9];
        aRenderer.lineWidth = 2;
        aRenderer.lineDashPattern = @[@2, @5];
        aRenderer.alpha = 0.5;

        return aRenderer;
    }
    else
    {
        return nil;
    }
} 

Now i only want to Overlay Text on the circle. but i dont have any idea :(