Tengo una aplicación de mapas que coloca anotaciones en el mapa, cuando las presiona, muestra la leyenda con el atributo de título.ios mapkit cierre las anotaciones de las anotaciones tocando el mapa
Esto funciona bien, pero el usuario no puede cerrarlos. Permanecen abiertos hasta que toquen otra anotación. ¿No puedo hacer que el usuario pueda tocar elsehwere en el mapa (o tocar la anotación nuevamente) para cerrarlo?
Tenía la sensación de que esta era la configuración predeterminada, ¿entonces quizás algo que estoy haciendo es rellenarlo? Tengo un reconocedor gesto que yo uso para detectar alguna mapa grifos
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]
initWithTarget:self action:@selector(handleTap:)];
tap.numberOfTapsRequired = 1;
[self.mapView addGestureRecognizer: tap];
que dispara la siguiente:
- (void)handleTap:(UITapGestureRecognizer *)sender {
if (sender.state == UIGestureRecognizerStateEnded) {
CGPoint tapPoint = [sender locationInView:sender.view.superview];
CLLocationCoordinate2D coordinate = [self.mapView convertPoint: tapPoint toCoordinateFromView: self.mapView];
if (pitStopMode && !pitStopMade){
pitStopMade = YES;
InfoAnnotation *annotation = [[InfoAnnotation alloc]
initNewPitstopWithCoordinate:coordinate];
NSLog(@" Created Pit Stop");
annotation.draggable = NO;
//place it on the map
[self.mapView addAnnotation: annotation];
self.instructionLabel.text = @"Tap button again to remove";
annotation.creatorId = self.localUser.deviceId;
//send it to the server
[annotation updateLocationWithServerForConvoy: self.convoyCode];
[annotation release];
}
if (hazardMode && !hazardMade){
hazardMade = YES;
InfoAnnotation *annotation = [[InfoAnnotation alloc]
initNewHazardWithCoordinate:coordinate];
NSLog(@" Created Hazard");
annotation.draggable = NO;
//place it on the map
[self.mapView addAnnotation: annotation];
self.instructionLabel.text = @"Tap button again to remove";
annotation.creatorId = self.localUser.deviceId;
//send it to the server
[annotation updateLocationWithServerForConvoy: self.convoyCode];
[annotation release];
}
}
}
¿Hay algo que tengo que hacer para que también estos grifos pasan por a la vista del mapa? Arrastrar y tocar en las anotaciones funciona bien, ¿así que no estoy seguro de si esto es lo que está causando?
¿Existe una opción que me falta, o tengo que intentar implementarla manualmente?