2011-09-16 3 views
1

MKMapViewのMKAnnotationViewをタップして、次のクラスに移動したいと考えています。これを行うにはどうしたらよいでしょうか?私は、これは以下のcode..explained行っていた MKAnnonationViewタップの問題

...

- (void)mapView:(MKMapView *)mapView1 didSelectAnnotationView:(MKAnnotationView *)customAnnotationView 
{ 
     //Here Push to another view controller 
} 

一つの問題は、一つの項目をクリックすると、このメソッドの呼び出しとは、それが他のクラスに移動しますが、私は戻ってきたときにして、もう一度タップすることですこのメソッドは呼び出されません。

あなたは、このメソッドを実装する必要があります...私は私にこの問題を解決するのに役立つ、事前に

おかげで...

答えて

2

してください: - 編集した

: - あなたが必要

を以下の方法を実施する。

- (void)mapView:(MKMapView *)mapView didSelectAnnotationView:(MKAnnotationView *)view 
{ 
    NSLog(@"touch"); 
    [mapView deselectAnnotation:view animated:NO]; 
    firstVC *aa=[[[firstVC alloc]initWithNibName:@"firstVC" bundle:nil] autorelease]; 
    [[self navigationController] pushViewController:aa animated:YES]; 

} 

-(void)mapView:(MKMapView *)mapView didDeselectAnnotationView:(MKAnnotationView *)view 
{ 
    NSLog(@"notouch"); 
    firstVC *aa=[[[firstVC alloc]initWithNibName:@"firstVC" bundle:nil] autorelease]; 
    [[self navigationController] pushViewController:aa animated:YES]; 

} 
以前

: - あなたの - (MKAnnotationView *) mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>) annotation方法

+0

私はMapViewの上の任意の注釈をタップしたときに呼び出さなっていないこの方法で

- (void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)view calloutAccessoryControlTapped:(UIControl *)control { CompanyDetail *detail = [[CompanyDetail alloc] initWithNibName:@"CompanyDetail" bundle:nil]; [self.navigationController pushViewController:detail animated:YES]; } Make sure you do UIButton* rightButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure]; 

、uがplzは –

+0

にこの方法を、それを解決するために私を助けることができます注釈の開示ボタンをクリックすると呼び出されます。ピン注釈を表示するときにボタンを追加しました – Gypsa

+0

開示ボタンを追加するのではなく、カスタム注釈を使用して画像を追加していますこの注釈をクリックします。私はこれをやりたいのですが...助けてください –

関連する問題