0

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方法は、このコードは先頭に詳細ビューをプッシュしdetailViewを表示するが、それがないている必要があります呼び出されますが、トップにdetailViewControllerをプッシュすることはできません、

[self.navigationController pushViewController:self.detailViewController animated:YES]; 

してください、

任意のヘルプは大

+0

あなたは役に立つかもしれませんこの質問の情報http://stackoverflow.com/questions/8285153/regarding-apples-kmlviewer-placemarkdescription-and-annotation-subtitle – Hari

答えて

1

があります..私は誰もがのMapView上の注釈の右ボタンをタップしたときである、私は事前にあなたに感謝、詳細ビューを表示したいやりたいこと、高く評価されるだろうターゲット/アクションは必要ありませんなし、吹き出しアクセサリビューをタップしたときに呼び出されるデリゲートメソッドがあります:mapView:annotationView:calloutAccessoryControlTapped:

+0

私はdetailViewControllerを持っています。どのように右のボタンがタップされたときにそのビューを表示することができます。 – jarus

0

はあなたの助けのために私は私のshowDetails方法

- (void)showDetails:(id)sender 
    { 
     detailViewController *dvController = [[detailViewController alloc] initWithNibName:nil bundle:nil]; 
     [self presentModalViewController:dvController animated:YES]; 
     [dvController release]; 
     dvController = nil; 
    } 
を変更することにより、detailViewControllerを開くことができるよ、ありがとう
関連する問題