У меня есть аннотации в MKMapView с выносками. В этих выносках есть кнопка «Стрелка вправо». Когда я нажимаю на него, я хочу открыть подробный вид, дополнительный UIViewController с собственным файлом nib и т. Д. Я использую следующий код:
В моем 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;
}
Кнопка работает, потому что, когда я даю NSLog внутри метода showDetais, он выводится на консоль. Проблема в том, что НИЧЕГО не происходит. При нажатии на кнопку, как будто нет кнопки. Там нет отладочной ошибки или исключения, просто ничего.
заголовок MapView выглядит примерно так:
@interface MapViewController : UIViewController <MKMapViewDelegate> {
MKMapView *map;
NSMutableDictionary *dictionary;
EntryDetailController *detailViewController;
}
@property (nonatomic,retain) IBOutlet MKMapView *map;
@property (nonatomic,retain) IBOutlet EntryDetailController *detailViewController;
Может быть, кто-то из вас может мне помочь:)
Спасибо!