我想要在點擊xcode中mapview註釋上的右鍵之後顯示詳細視圖,但是我無法獲取要顯示的視圖, 我的代碼:試圖推動一個詳細視圖,當在xcode中註釋mapview的註釋時點擊右鍵
- (void)showDetails:(id)sender
{
[self.navigationController setToolbarHidden:YES animated:NO];
[self.navigationController pushViewController:self.detailViewController animated:YES];
}
- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation
{
static NSString* BridgeAnnotationIdentifier = @"bridgeAnnotationIdentifier";
MKPinAnnotationView* customPinView = [[[MKPinAnnotationView alloc]
initWithAnnotation:annotation reuseIdentifier:BridgeAnnotationIdentifier] autorelease];
customPinView.pinColor = MKPinAnnotationColorPurple;
customPinView.animatesDrop = YES;
customPinView.canShowCallout = YES;
UIButton* rightButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
NSLog(@"%@",rightButton);
[rightButton addTarget:self
action:@selector(showDetails:)
forControlEvents:UIControlEventTouchUpInside];
customPinView.rightCalloutAccessoryView = rightButton;
return customPinView;//[kml viewForAnnotation:annotation];
}
的showDetails方法被調用,但不能推detailViewController頂端,
[self.navigationController pushViewController:self.detailViewController animated:YES];
這段代碼應該推詳細視圖頂部和顯示的DetailView但它確實不請,
任何幫助,將不勝感激,我想做的事情是,當有人上的MapView註釋的右鍵水龍頭,我想展示的細節圖,請多關照..
您可能會覺得有用在這個問題的信息http://stackoverflow.com/questions/8285153/regarding-apples-kmlviewer-placemarkdescription-and-annotation-subtitle – Hari 2012-03-21 22:56:35