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 8695663
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T01:05:32+00:00 2026-06-13T01:05:32+00:00

The following code returns me no annotation selected CalloutAccessories delegates helps to figure out

  • 0

The following code returns me “no annotation selected” CalloutAccessories delegates helps to figure out which annotation selected. my code is below. Any idea(s)? Thanks in advance

“RemoveViewController.m”

- (IBAction)removePin:(id)sender {
AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
[[appDelegate viewController] removeAnno];
[self.navigationController popViewControllerAnimated:YES];

}

“ViewController.m”

- (void)mapView:(MKMapView *)mapView 
 annotationView:(MKAnnotationView *)view calloutAccessoryControlTapped:(UIControl *)control {

    if ([(UIButton*)control buttonType] == UIButtonTypeDetailDisclosure){
        // Do your thing when the detailDisclosureButton is touched
        RemoveViewController *settingAnnotation = [[RemoveViewController alloc]initWithNibName:@"RemoveViewController" bundle:nil];
        Annotation *annotation1;
        annotation1 = view.annotation;
        settingAnnotation.title = annotation1.title;
        settingAnnotation.subtitle = annotation1.subtitle;
        [self.navigationController pushViewController:settingAnnotation animated:YES];
    } 

}

- (void)removeAnno{

    [mapView removeAnnotations: mapView.selectedAnnotations];
    if (mapView.selectedAnnotations.count == 0)
    {
        NSLog(@"no annotation selected");
    }
    else
    {
        id<MKAnnotation> ann = [mapView.selectedAnnotations objectAtIndex:0];
        CLLocationCoordinate2D coord = ann.coordinate;
        NSLog(@"lat = %f, lon = %f", coord.latitude, coord.longitude);
    }
}
  • 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-06-13T01:05:33+00:00Added an answer on June 13, 2026 at 1:05 am

    Yes, get the annotation (if any) at index 0 of the selectedAnnotations array and read its coordinate property:

    if (mapView.selectedAnnotations.count == 0)
    {
        NSLog(@"no annotation selected");
    }
    else
    {
        id<MKAnnotation> ann = [mapView.selectedAnnotations objectAtIndex:0];
        CLLocationCoordinate2D coord = ann.coordinate;
        NSLog(@"lat = %f, lon = %f", coord.latitude, coord.longitude);
    }
    

    You should probably do this before calling removeAnnotations.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The following code returns me people with similar telephone numbers. It works perfectly but
The following code returns the error from the For Each loop. I have similar
The following code returns an error and I dont know why: require rexml/document include
I the following code returns every text that has the price class associated to
ms-access is connecting to a local mysql database the following code returns an error:
Forgive me, I'm a beginner. The following code returns a parse error: $query =
The following C code returns a segmentation fault error. I do not understand why
I have the following code that returns a .CSV file when a link is
I have the following code that returns HTTP error 400 everytime I try to
I have multiple messages in SQS. The following code always returns only one, even

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.