Note that there are some explanatory texts on larger screens.

plurals
  1. POiPhone: Combining MKMapView with another UITapGestureRecognizer
    primarykey
    data
    text
    <p>i am trying to implement my own gesture recognizer in addition to the one already used by the MKMapView. Right now i can tap on the map and set a pin. This behavior is realized by my UITapGestureRecognizer. When i tap on a pin that already exists, my gesture recognizer does nothing, but instead the callout bubble of this pin is shown. The UIGestureRecognizerDelegate looks like this:</p> <pre><code>-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch { if (gestureRecognizer == self.tapRecognizer) { bool hitAnnotation = false; int count = [self.mapView.annotations count]; int counter = 0; while (counter &lt; count &amp;&amp; hitAnnotation == false ) { if (touch.view == [self.mapView viewForAnnotation:[self.mapView.annotations objectAtIndex:counter]]) { hitAnnotation = true; } counter++; } if (hitAnnotation) { return NO; } } return YES; } </code></pre> <p>This works fine. My only problem are the callout bubbles of the pins and the double tap. Normally the double tap is used for zooming in. This still works but in addition to this, i also get a new pin. Is there any way to avoid this?</p> <p>The other problem occurs with the callout bubble of a pin. I can open the bubble by tapping on the pin without setting a new pin at this place (see code above) but when i want to close the bubble by tapping on it, another pin is set. My problem is, that i cannot check with touch.view , if the user tapped on a callout bubble, because it is not a regular UIView as far as i know. Any ideas or workarounds for this problem?</p> <p>Thanks</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload