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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T15:03:02+00:00 2026-05-26T15:03:02+00:00

I want to create a custom MKAnnotationView callout as shown in this image. I

  • 0

I want to create a custom MKAnnotationView callout as shown in this image. I have tested several solutions but they only allow customization of the left/right images and title/subtitle. Can anybody please give me some source code or tutorial link for it?

Currently I am clueless. Please help.

enter image description here

  • 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-26T15:03:03+00:00Added an answer on May 26, 2026 at 3:03 pm

    I understand you want a pin with a custom callout.

    We can’t create a custom callout, but we can create an annotation with a completely customized view. So the trick is to add a second annotation when the first is selected, and make the 2nd annotation view look like a callout bubble.

    This is the solution posted by users djibouti33 and jacob-jennings in the answer: MKAnnotationView – Lock custom annotation view to pin on location updates, which in turn is based in a blog post from Asynchrony Solutions. For explanation purposes, here is some UML from a forked project:
    Annotation with custom XIB

    This is a big hack, but also the cleanest way I’ve seen to implement custom annotations.

    Start with a NSObject “Content” class which has a coordinate, the class of the callout view to use (in the UML is AnnotationView, but you can create more and set them here), and a dictionary of random values with the title, photo url, etc. Use this class to initialize a MKAnnotation “Annotation” object.

    #import <MapKit/MapKit.h>
    @interface Content : NSObject
    @property (nonatomic,assign) CLLocationCoordinate2D coordinate;
    // ...
    
    @interface Annotation : NSObject <MKAnnotation, AnnotationProtocol>
    -(id) initWithContent:(Content*)content;
    // ...
    

    The Annotation implements AnnotationProtocol to announce it wants to handle the creation of its own MKAnnotationView. That is, your MKMapViewDelegate should have code like this:

    - (MKAnnotationView *)mapView:(MKMapView *)aMapView viewForAnnotation:(id<MKAnnotation>)annotation 
    {
        // if this is a custom annotation, delegate the implementation of the view
        if ([annotation conformsToProtocol:@protocol(AnnotationProtocol)]) {
            return [((NSObject<AnnotationProtocol>*)annotation) annotationViewInMap:mapView];
        } else {
            // else, return a standard annotation view
            // ...
        }
    } 
    

    The view returned will be of type AnnotationView, which implements AnnotationViewProtocol to announce that it wants to handle selection/deselection. Therefore, in your map view controller, the methods mapView:didSelectAnnotationView: and mapView:didDeselectAnnotationView: should delegate in a similar way to what we saw before.

    When the annotation is selected, a second annotation (CalloutAnnotation) is added, which follows the same behaviour, but this time the view returned (CalloutView) is initialized from a XIB, and contains Core Graphics code (in BaseCalloutView) to animate and replicate a callout.

    The initializer of the CalloutView class:

    - (id)initWithAnnotation:(CalloutAnnotation*)annotation
    {
        NSString *identifier = NSStringFromClass([self class]);
        self = [super initWithAnnotation:annotation reuseIdentifier:identifier];
        if (self!=nil){
            [[NSBundle mainBundle] loadNibNamed:identifier owner:self options:nil];
            // prevent the tap and double tap from reaching views underneath
            UITapGestureRecognizer *tapGestureRecognizer = ...
        }
        return self;
    }
    

    To be able to push another view controller from the callout view I used notifications.

    The SO answer I linked at the top contains two complete projects implementing this code (class names may differ). I have another project using the UML above at https://github.com/j4n0/callout.

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

Sidebar

Related Questions

I want to create a custom control in C#. But every time I have
I want to create custom Textbox control in asp.net.But i have one doubt when
I want to create a custom callout bubble on MKMapView. But I want to
I want to create a custom modelbinder which validates the bounded model. I have
I want to create custom tag, but i get XML parsing error on JSPVersion
I want to create a simple game.I need this information how to create custom
I want to create a custom button in ActionScript. This is my code: import
I want to create a custom drawable for RadioButton's button drawable. I have created
I want to create a custom toolbar control (descendant TToolBar) which should have some
i want to create a custom view class. But I get an error by

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.