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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T06:29:31+00:00 2026-05-16T06:29:31+00:00

Wanted some help with a problem with mapkit I am facing. Should be a

  • 0

Wanted some help with a problem with mapkit I am facing. Should be a silly problem or I have missed out something while going through the mapkit framework.

Here is the senario.
I am placing multiple annotation on the map when the user performs some search like pizza.
Added button for the right annotation view, on click which opens a next detail view. The problem is how to send some information to the next view, for example I add index to annotations while creating them, now I want to access this information from annotation, and pass it to the next view via the selector set on the button.

I have checked all the mapkit delicate, but don’t find a one where I can map this information with the next view and annotation.

Hope I have not confused you guys in my question. Please let me know I will reframe it.

Thaking in advance.

  • 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-16T06:29:32+00:00Added an answer on May 16, 2026 at 6:29 am

    When you create the UIButton for the annotation, set the tag property (tag is an NSInteger property of UIView) to an id or array index that identifies the relevant object. You can then retrieve that tag value from the sender parameter to your selector.


    Edit: here’s some sample code.

    You create your annotation view and associate the button in your delegate’s -mapView:viewForAnnotation: method:

    - (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation {
        // Boilerplate pin annotation code
        MKPinAnnotationView *pin = (MKPinAnnotationView *) [self.map dequeueReusableAnnotationViewWithIdentifier: @"restMap"];
        if (pin == nil) {
            pin = [[[MKPinAnnotationView alloc] initWithAnnotation: annotation reuseIdentifier: @"restMap"] autorelease];
        } else {
            pin.annotation = annotation;
        }
        pin.pinColor = MKPinAnnotationColorRed
        pin.canShowCallout = YES;
        pin.animatesDrop = NO;
    
        // now we'll add the right callout button
        UIButton *detailButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
    
        // customize this line to fit the structure of your code.  basically
        // you just need to find an integer value that matches your object in some way:
        // its index in your array of MKAnnotation items, or an id of some sort, etc
        // 
        // here I'll assume you have an annotation array that is a property of the current
        // class and we just want to store the index of this annotation.
        NSInteger annotationValue = [self.annotations indexOfObject:annotation];
    
        // set the tag property of the button to the index
        detailButton.tag = annotationValue;
    
        // tell the button what to do when it gets touched
        [detailButton addTarget:self action:@selector(showDetailView:) forControlEvents:UIControlEventTouchUpInside];
    
        pin.rightCalloutAccessoryView = detailButton;
        return pin;
    

    }

    Then in your action method, you’ll unpack the value from tag and use it to display the right detail:

    -(IBAction)showDetailView:(UIView*)sender {
        // get the tag value from the sender
        NSInteger selectedIndex = sender.tag;
        MyAnnotationObject *selectedObject = [self.annotations objectAtIndex:selectedIndex];
    
        // now you know which detail view you want to show; the code that follows
        // depends on the structure of your app, but probably looks like:
        MyDetailViewController *detailView = [[MyDetailViewController alloc] initWithNibName...];
        detailView.detailObject = selectedObject;
    
        [[self navigationController] pushViewController:detailView animated:YES];
        [detailView release];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some weird problem while uploading a file with a Cyrillic name using
I have designed an html document editor and I wanted some help in resolving
I need some help! I have no doubt this is a dumb problem that
I wanted some system where I didn't have to keep looking at the Exception
This is going to be a quick discussion, but I just wanted some feedback
I wanted to learn some graphics and thereby gaming coding in iPhone. I have
Ok been working with WPF for a while but I need some help. I
Just out of curiosity i wanted to make something similar to what pretty much
I would like some help with a problem. In Python: a=array([2,2]) b=ones((2,10)) I would
I'm new here and I wanted to get some help solving an Access SQL

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.