Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6093459
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T12:33:44+00:00 2026-05-23T12:33:44+00:00

I need to draw a circle to display the distance around a point that

  • 0

I need to draw a circle to display the distance around a point that I have plotted.

Where should I implement these two lines of code to make it work? I tried putting it in viewWillAppear: but the circle does not appear.

[self addCircle:_coordinate];
[self addCircleWithRadius:5.5 addCircleWithCoordinate:_coordinate];

- (void)addCircle: (CLLocationCoordinate2D)coordinate
{
    // draw the radius circle for the marker

    double radius = 2000.0;
    MKCircle *circle = [MKCircle circleWithCenterCoordinate:coordinate radius:radius];
    [circle setTitle:@"background"];
    [_mapView addOverlay:circle];

    MKCircle *circleLine = [MKCircle circleWithCenterCoordinate:coordinate radius:radius];
    [circleLine setTitle:@"line"];
    [_mapView addOverlay:circleLine];
}

- (void)addCircleWithRadius:(double)radius addCircleWithCoordinate: (CLLocationCoordinate2D) coordinate
{

    MKCircle *circle = [MKCircle circleWithCenterCoordinate:coordinate radius:radius];
    [circle setTitle:@"background"];
    [_mapView addOverlay:circle];

    MKCircle *circleLine = [MKCircle circleWithCenterCoordinate:coordinate radius:radius];
    [circleLine setTitle:@"line"];
    [_mapView addOverlay:circleLine];
}

- (void)sliderChanged:(UISlider*)sender
{
    [_mapView removeOverlays:[_mapView overlays]];

    double radius = (sender.value * 100);
    CLLocationCoordinate2D coordinate = self.coordinate;

    [self addCircleWithRadius:radius addCircleWithCoordinate:coordinate];
}

- (MKOverlayView *)mapView:(MKMapView *)mapView viewForOverlay:(id <MKOverlay>)overlay{
    MKCircle *circle = overlay;
    MKCircleView *circleView = [[[MKCircleView alloc] initWithCircle:overlay] autorelease];

    if ([circle.title isEqualToString:@"background"])
    {
        //circleView.fillColor = UIColorFromRGB(0x598DD3);
        circleView.alpha = 0.25;
    }
    else
    {
        //circleView.strokeColor = UIColorFromRGB(0x5C8AC7);
        circleView.lineWidth = 2.0;
    }

    return circleView;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T12:33:45+00:00Added an answer on May 23, 2026 at 12:33 pm

    While you could try viewDidAppear instead of viewWillAppear, I think it should already work in that regard. I think that you have something else wrong, and you should step through with a debugger to find it. Check the usual suspects:

    • Set the fill color. Make it opaque and obvious.
    • _mapView might be nil or zombied during runtime. (or not mapped in your xib)
    • The coordinates or radius may be different than you expect. Check the actual coordinate values in your debugger.
    • Everything may be correct except that the coordinates are not located in your map’s zoomed area.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to draw a circle around a vertex in JUNG . The circle
I need to have all point coordinates for a given circle one after another,
I need draw rectangle with two circle holes inside. The problem is in circles
I need to draw a circle in google Maps V3 but I have 2
I need to draw a circle as per my finger move so i have
I need to draw a part of a perfect circle using graphics.curveTo (I have
I need to draw a circle onto a bitmap in a specific colour given
I need to draw a rectange,circle and line and then animate them(press left ->
I need to draw a lot of lines. I'm using UIBezierPath for drawing lines
I need to draw on a TPanel, ideally directly so I don't have another

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.