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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T23:29:13+00:00 2026-06-02T23:29:13+00:00

I have a custom MKAnnotationView . In its setselected:animated method I’m adding to it

  • 0

I have a custom MKAnnotationView. In its setselected:animated method I’m adding to it a custom bubble loaded from a nib, adjust the annotationview’s frame to include this view and redraw the annotation circle with other color, like this (first – not selected , second – selected, blue – frame, green – custom bubble view with alpha = 0.8, red – the annotationview):

enter image description here

It works fine, the bubble appears, and can be “closed” only by tapping outside of it (this is why I’ve increased the frame). I have some buttons on this bubble and they are clickable if there is nothing under the annotation just the map.

BUT when under the callout bubble there is another annotation I can click “through” the entire bubble. When I tap on one of the buttons, the tap highlight appears, but an other annotation gets selected because the didSelectAnnotationView fires …

I tried to make the bubble opaque/semitransparent, no luck; set exclusiveTouch on buttons, on the view itself, no luck; tried not to mess with frame, still can click through.
Am I missing something ?

Thanks

Edit : Shorter: Why can I click through a UIView added in addSubview in an MKAnnotationView if there is other MKAnnotaionView under this UIView ?

Details :

- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
  if(selected)
  {
    initialFrame = self.frame;       // save frame and offset to restore when deselected
    initialOffset = self.centerOffset;  // frame is correct for a circle, like {{2.35, 1.47}, {12, 12}}

    if (!self.customCallout) 
    {
      self.customCallout = [[[NSBundle mainBundle] loadNibNamed:@"CustomCallout" owner:self options:nil] objectAtIndex:0];
    }
    // adjust annotationview's frame and center
    // callout is 200x120, here frame is {{2.35, 1.47}, {200, 132}} 
    self.customCallout.layer.cornerRadius=5;
    self.customCallout.exclusiveTouch = YES;
    [self addSubview:self.customCallout];
  }
...
}

initWithAnnotation has these :

   self.canShowCallout = NO;  // to appear the subview
   self.exclusiveTouch = YES; // ...
   self.enabled = YES;
   self.opaque = YES;
  • 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-02T23:29:14+00:00Added an answer on June 2, 2026 at 11:29 pm

    The default behavior of the touch handling methods (touchesBegan: touchesEnded: etc.) have this note in the documentation:

    The default implementation of this method does nothing. However immediate UIKit subclasses of UIResponder, particularly UIView, forward the message up the responder chain.

    MKAnnotationView is a subclass of UIVIew. As a result, when your annotation gets a touch, it is passing it to it’s super class and on up the responder chain, so eventually you map view gets the touch and activates the covered annotation.

    To resolve, implement the touch handling methods in your annotationView class, and do not pass the touch events up the responder chain.

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

Sidebar

Related Questions

I have custom drupal module. I receive result from a webservice that I need
I have custom annotation pin at app: - (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation {
I have created Custom Annotation with following: -(MKAnnotationView*)mapView:(MKMapView *)mapView viewForAnnotation:(id<MKAnnotation>)annotation { MKPinAnnotationView *view =
I have custom assembly that is loaded on runtime. at this point i have
I have successfully changed MKAnnotationView to use my custom image with the following code
I have custom Rythm template tag (sayHi.html) which I want to call from parent
I have a custom MKAnnotationView where I set my image myself in viewForAnnotation. How
I have a custom MKAnnotationView subclass. It is showing the view exactly as I
I have a MKAnnotation with an custom pin image. However the pin(MKAnnotationView) centers the
I have custom coded several enterprise applications for mid to large organizations to use

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.