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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T09:27:23+00:00 2026-06-01T09:27:23+00:00

When using the MapKit library and placing a pin/MKAnnotation, you will implement the MKAnnotation

  • 0

When using the MapKit library and placing a pin/MKAnnotation, you will implement the MKAnnotation class having the coordinates, name and description:

@interface MyAnnotationClass : NSObject <MKAnnotation> {
    NSString *_name;
    NSString *_description;
    CLLocationCoordinate2D _coordinate;
}
@property (nonatomic, retain) NSString *name;
@property (nonatomic, retain) NSString *description;
@property (nonatomic, readonly) CLLocationCoordinate2D coordinate;
-(id) initWithCoordinate:(CLLocationCoordinate2D) coordinate;
@end

These core details are displayed when a pin is placed on the map. However, when you want to have that same pin have a button, you implemente the following method in the MapViews Delegate:

-(MKAnnotationView *)mapView:(MKMapView *)mapview viewForAnnotation:(id <MKAnnotation>)annotation {
    ...
    annotationView.rightCalloutAccessoryView = [UIButton buttonWithType:UIButtonTypeDetailDisclosure]; 
    return(annotationView);
}

Why is this the convention? I would expect that the ‘rightCalloutAccessory’ would be a part of MKAnnotation. I know that this is optional, so could it be that the rightCallout object is part of a more specific method?

It is confusing to me because you are setting the attributes of a Pin when creating the MKAnnotation object, but then setting other attributes when the pin is being placed on the map. Why arent both of these done in the same place? Is it possible to do it that way?

  • 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-01T09:27:24+00:00Added an answer on June 1, 2026 at 9:27 am

    Usually the MKAnnotation protocol is implemented by model objects. The model layer isn’t supposed to know anything about views. So to honor the MVC pattern the callout view can not be part of the MKAnnotation object.

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

Sidebar

Related Questions

Having follow the tutorial at http://mithin.in/2009/06/22/using-iphone-sdk-mapkit-framework-a-tutorial/ to integrate the MapKit into my application. However,
DisplayMap.h #import <Foundation/Foundation.h> #import <MapKit/MKAnnotation.h> @interface DisplayMap : NSObject <MKAnnotation> { CLLocationCoordinate2D coordinate; NSString
I'm working on an application using the MapKit in iOS. I'm having trouble because
Im using MapKit in my application and disaply the user location with [mapview setShowUserLocation:YES];
I'm using MapKit to display the user's location relative to pins around them. I'd
I am using the MapKit for the iPhone and have it setup to get
In my iphone application, I'm using MapKit with MKMapView and custom MKAnnotationView. The problem
I am using MapKit. I want to know how to get current user's location.
In my iPhone app I'm using MapKit to show the user where he is,
Is there any way, using MapKit in iOS, to search a place on Google

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.