Domanda

I have MKMapView with MKPlacemark on it. When showing the map, I'm showing place mark's title. Everything is fine until now.

I want to disable hiding title when user touches it.

I tried to add

myMapView.userInteractionEnabled = NO;
myMapView.multipleTouchEnabled = NO;

Which helps, but completely disables interaction with map. I want to leave a possibility to zoom in/out and moving the map.

È stato utile?

Soluzione 2

The following code did the trick

for (UIGestureRecognizer *g in [myMapView gestureRecognizers]) 
        [myMapView removeGestureRecognizer:g];

Altri suggerimenti

Instead of creating PIN, create your custom annotation. In custom annotation create the view with all the info that you want to present to user, and disable the place mark. By that you are not suppose to handle taps but you will show all the static/dynamic info attached to one lattitude/longitude.

In MapKit Delegate method try bellow code

- (MKAnnotationView *)mapView:(MKMapView *)mV viewForAnnotation:(id <MKAnnotation>)annotation {

    static NSString *defaultPinID = @"com.invasivecode.pin";
    MKPinAnnotationView *pinView  = (MKPinAnnotationView *)[yourMapView dequeueReusableAnnotationViewWithIdentifier:defaultPinID];
    pinView = [[[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:defaultPinID] autorelease];
    if (annotation == yourMapview.userLocation)
        return nil;

    pinView.pinColor = MKPinAnnotationColorRed;

    pinView.userInteractionEnabled = NO;

    //pinView.canShowCallout = YES;
    pinView.animatesDrop = YES;

    return pinView;
}

here if you use your placemark with this logic may its work.... hope,this help you... :)

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top