J'ai des annotations dans un MKMapView avec des légendes. Dans cette légende il y a un bouton "flèche droite". En cliquant dessus, je veux ouvrir une vue de détail, un UIViewController supplémentaire avec son propre etc fichier nib j'utiliser le code suivant:MKMapView Annotation Légende Bouton vers DetailView?
Dans mon MapViewController:
- (void)showDetails:(id)sender {
// the detail view does not want a toolbar so hide it
[self.navigationController setToolbarHidden:YES animated:NO];
NSLog(@"pressed!");
[self.navigationController pushViewController:self.detailViewController animated:YES];
NSLog(@"pressed --- 2!");
}
- (MKAnnotationView *) mapView:(MKMapView *)mapView viewForAnnotation:(Annotation *) annotation {
if(annotation == map.userLocation) return nil;
static NSString* AnnotationIdentifier = @"AnnotationIdentifier";
MKPinAnnotationView* customPinView = [[[MKPinAnnotationView alloc]
initWithAnnotation:annotation reuseIdentifier:AnnotationIdentifier] autorelease];
customPinView.pinColor = MKPinAnnotationColorRed;
customPinView.animatesDrop = YES;
customPinView.canShowCallout = YES;
UIButton* rightButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
[rightButton addTarget:self
action:@selector(showDetails:)
forControlEvents:UIControlEventTouchUpInside];
customPinView.rightCalloutAccessoryView = rightButton;
UIImageView *memorialIcon = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"googlemaps_pin.png"]];
customPinView.leftCalloutAccessoryView = memorialIcon;
[memorialIcon release];
return customPinView;
}
Les travaux de bouton, parce que quand je donne un NSLog dans la méthode showDetais, il est imprimé sur la console. Le problème est, que rien ne se passe. Lorsque vous cliquez sur le bouton, c'est comme s'il n'y avait aucun bouton. Il n'y a pas d'erreur ou d'exception de débogage, juste rien.
l'en-tête MapView ressemble à ceci:
@interface MapViewController : UIViewController <MKMapViewDelegate> {
MKMapView *map;
NSMutableDictionary *dictionary;
EntryDetailController *detailViewController;
}
@property (nonatomic,retain) IBOutlet MKMapView *map;
@property (nonatomic,retain) IBOutlet EntryDetailController *detailViewController;
Peut-être que quelqu'un d'entre vous peut me aider :)
Merci!