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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T02:43:45+00:00 2026-05-27T02:43:45+00:00

I have custom annotation pin at app: – (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation {

  • 0

I have custom annotation pin at app:

- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation
{
    return [kml viewForAnnotation:annotation type:state];
}

where I return custom view and make setImage for annotationView of Placemark such as:

- (MKAnnotationView *)viewForAnnotation:(id <MKAnnotation>)point type:(int)state
{
    // Find the KMLPlacemark object that owns this point and get
    // the view from it.
    for (KMLPlacemark *placemark in _placemarks) {
        if ([placemark point] == point) 
        {
            UIButton *disclosureButton = [UIButton buttonWithType: UIButtonTypeDetailDisclosure]; 
            [[placemark annotationView] setCanShowCallout: YES];            
            [[placemark annotationView] setRightCalloutAccessoryView:disclosureButton];

            if (state == 0)
            {
                [[placemark annotationView] setImage:[UIImage imageNamed:@"ic_pin_tour.png"]];
            }
            else
            {
                [[placemark annotationView] setImage:[UIImage imageNamed:@"ic_pin_point.png"]];
            }

            return [placemark annotationView];
        }
    }
    return nil;
}

but if I long tap at my annotation pin it changes appearance to its default view (RedPin).
I cannot understand what method is called on long tap. I tried to play with UITapGestureRecognizer, but did not find out. If I just tap annotation pin all works fine and my custom annotation pin view doesn’t disappear.
You can see what I mean in this screenshot:
so useful image with example

So, why annotation pin appearance changes on long tap?

  • 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-27T02:43:46+00:00Added an answer on May 27, 2026 at 2:43 am

    So, if you want to use a custom image for an annotation view, always use a generic MKAnnotationView instead of an MKPinAnnotationView.
    I have MKPinAnnotationView at just one place, when I replace it with MKAnnotationView everything works properly now:

    - (MKAnnotationView *)annotationView
    {
        if (!annotationView) {
            id <MKAnnotation> annotation = [self point];
            if (annotation) {
                MKAnnotationView *pin =
                    [[MKAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:nil];
                pin.canShowCallout = YES;
                annotationView = pin;
            }
        }
        return annotationView;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created Custom Annotation with following: -(MKAnnotationView*)mapView:(MKMapView *)mapView viewForAnnotation:(id<MKAnnotation>)annotation { MKPinAnnotationView *view =
I have a mapview and i put an annotation which shows a custom title
i'm experimenting with seam interceptors. I i have a custom annotation defined as: @Target(TYPE)
I have a custom MKAnnotationView where I set my image myself in viewForAnnotation. How
I'm trying to implement a custom validation annotation in Seam. We have a list
I have custom classes that I currently instantiate within App.xaml as resources. I want
I have a custom ViewGroup (blue background) that when touched sometime during the app's
I have some map view controller and I have a custom annotation. Custom annotation
I'm trying to create a custom validation wherein I have defined the annotation to
At work we have a custom ServiceProvider pattern with an annotation for binding services

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.