2012-10-29 3 views
2

사용자 위치의 가장 가까운 도시로 확대하는 iPhone 앱이 있으며 사용자가 userLocation 주석을 두 번 탭하고 약 줌으로지도를 표시 할 수있게하려고합니다. 블록 정도.MKMapView에서 사용자 위치 주석의 트랙 선택

userLocation 주석에 탭이 있음을 인식하도록하려면 어떻게해야합니까?

+0

당신이 내 코드를 시도 않았다 당신의 인터페이스 파일에 MKMapViewDelegate을 추가 할 필요가? –

+0

아직 아니지만 지금 당장! – barndog

답변

6
- (void)mapView:(MKMapView *)mapView1 didSelectAnnotationView:(MKAnnotationView *)mapView2 
{ 
    id<MKAnnotation> annotation = mapView2.annotation; 
    if ([annotation isKindOfClass:[MKUserLocation class]]) { 
      // this is where you can find the annotation type is whether it is userlocation or not... 
    } 
} 

위의 방법은 위임 방법입니다 당신은 내가 제안

+0

음 MapAnnotation은 유형이 아닙니다. MKAnnotation하지만 MKAnnotation 개체를 선언하려고 할 때마다 알 수없는 형식의 'MKAnnotation'에서 오류가 발생합니다 – barndog

+0

가는 것이 좋습니다 ?? 너 해봤 니? –

+0

내 친구에게가는 것이 좋다. – barndog

관련 문제