-1
Je crée des annotations personnalisées pour l'affichage de la carte. Lorsque je place une épingle sur la carte montrant l'annotation avec 2 boutons. c'est un travail pour ios 6, mais quand je teste ce code dans ios 5, je ne vois aucune annotation.Annotation MapKit IOS 5 ne pas afficher
- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation
{
if ([annotation isKindOfClass:[MKUserLocation class]])
return nil; //return nil to use default blue dot view
NSLog(@"viewForAnnotation");
MKAnnotationView *annotationView = [[MKPinAnnotationView alloc]
initWithAnnotation:annotation reuseIdentifier:@"loc"];
annotationView.draggable = YES;
UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[button setTitle:@"Добавить" forState:(UIControlStateNormal)];
button.frame = CGRectMake(0, 0, 76, 23);
if (plased == YES){
annotationView.rightCalloutAccessoryView = button;
}
[button addTarget:self action:@selector(fixPoint:) forControlEvents:(UIControlEventTouchUpInside)];
UIButton *buttonLeft = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[buttonLeft setTitle:@"Удалить" forState:(UIControlStateNormal)];
buttonLeft.frame = CGRectMake(0, 0, 66, 23);
[buttonLeft addTarget:self action:@selector(cancelPoint:) forControlEvents:(UIControlEventTouchUpInside)];
if (plased == YES){
annotationView.leftCalloutAccessoryView = buttonLeft;
}
annotationView.tag = [geoPointsList count]+1;
annotationView.canShowCallout = YES;
return annotationView;
}