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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T13:54:40+00:00 2026-05-30T13:54:40+00:00

I have an annotation class that conforms to the MKAnnotation protocol. The class has

  • 0

I have an annotation class that conforms to the MKAnnotation protocol. The class has an init method which sets coordinates, title, and subtitle.

I create an array of these annotations and add them to a MKMapView the normal way by using addAnnotations:annotationArray.

Then in the MKMapViewDelegage method - (MKAnnotationView *)mapView:(MKMapView *)theMapView viewForAnnotation:(id <MKAnnotation>)annotation I create a MKPinAnnotationView with a custom pin color, animatesDrop, canShowCallout. The callout has a UIButton of type UIButtonTypeDetailDisclosure.

When I run the application and click on a pin on the map I get the expected results which is the callout with title, subtitle, and the detailDisclosure button.

The thing I’m trying to figure out is how to pass data to a details page ([self.navigationController pushViewController:detailsController animated:YES];) when the user clicks the detail disclosure button. I tried to modify my annotations class by adding an additional parameter to the init method however I cannot access that parameter in the - (void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)view calloutAccessoryControlTapped:(UIControl *)control method. It seems I can only access title and subtitle from there by doing something like this [view.annotation title].

I’m not sure what to do here, I can’t seem to find any documentation on how to do this either…

Again. I want to pass an object to a detail view controller. The object would contain various data that would be used on the details page…

PS – I’m using Xcode 4.2 w/ ARC.

  • 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-30T13:54:41+00:00Added an answer on May 30, 2026 at 1:54 pm

    In the calloutAccessoryControlTapped, the annotation reference is the exact annotation object you created and added but the reference is typed generically as id<MKAnnotation>.

    To access the custom properties in your annotation class, you can first cast it:

    YourAnnotationClass *myAnn = (YourAnnotationClass *)view.annotation;
    
    //now you can explicitly reference your custom properties...
    NSLog(@"myAnn.customProp = %@", myAnn.customProp);
    

    Make sure the “customProp” is defined as a property in your annotation class.

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

Sidebar

Related Questions

I have a test class that has a @Resource annotation for a setter and
I have a C# annotation which is : [AttributeUsage(AttributeTargets.Method)] public class OperationInfo : System.Attribute
I have a class that extends javax.annotation.processing.AbstractProcessor , which I'd like to run over
I have a method annotated with @PrePersist annotation but I've seen that when this
I have a mapview with several annotations. Every annotation has a leftCalloutAccessoryView which is
I have written a small class, which reads out annotation from methods. Now I
I have a generic class that is also a mapped super class that has
I'm working with java. I have an interface that has an annotated method in
I have a class that uses a method from a bean. I'm trying to
I have the following java class with the JAXB @XMLRootElement annotation @XmlRootElement(name=ClientData) public class

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.