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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T18:48:21+00:00 2026-05-31T18:48:21+00:00

I have an app that has a mapview, and it shows 20 pins (from

  • 0

I have an app that has a mapview, and it shows 20 pins (from an Array) on the map. When the user clicks on it, it can show a bubble with a right accessory button.
Here come my problem: How do I know which pin was pressed?
I heard something about the mapView:didSelectAnnotationView method, but I don’t really understand how do you get the pin/callout index, so that I can get the information of the object at the same index of my Array? Thanks for any help!

  • 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-31T18:48:23+00:00Added an answer on May 31, 2026 at 6:48 pm

    When that method gets called — because your viewController class has adopted MKMapViewDelegate, you can call -indexOfObject on the array and get the index of that pin (annotation). This is with the assumption that your array holds objects of the kind of annotation class.

    - (void)mapView:(MKMapView *)mapView didSelectAnnotationView:(MKAnnotationView *)view {
            // Annotation is your custom class that holds information about the annotation
            if ([view.annotation isKindOfClass:[Annotation class]]) {
                Annotation *annot = view.annotation;
                NSInteger index = [self.arrayOfAnnotations indexOfObject:annot];
            }
        }
    

    If you need more explanation, we need to know how you are adding those pins, i.e. implementation of - (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation.

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

Sidebar

Related Questions

I have an app that has settings the user can pick before running the
I have a small app that from the home screen has a few buttons,
I have c# app that has UI and background threads. Based on user input
i have an app that has an inapp purchase. in this store i can
I have an app that has a FK to USER. In ALL templates I
I have an app that has some consumable items, after they are used, user
I have an android app that takes an array from a website {d:[{latitude:-1.0,longitude:-1.0,time:07:14 PM
Have an app that has listings - think classified ads - and each listing
I have an app that has a centre view with two views off to
I have an app that has a tabbar at the bottom. When I select

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.