2015-05-21 54 views

回答

7
- (void)mapView:(MKMapView *)mapView didSelectAnnotationView:(MKAnnotationView *)aView 
    { 
     indexPathTag=aView.tag; 
     [mapView deselectAnnotation:aView.annotation animated:YES]; 

    } 
- (void)mapView:(MKMapView *)mapView didDeselectAnnotationView:(MKAnnotationView *)aView 
    { 
    } 

當didSelectAnnotationView火災,它選擇在某種程度上其實標記註釋。然後,當您再次單擊它時,代理功能不會觸發,因爲它已被選中。一旦完成了所需的任務,您必須通過調用以下函數來手動取消註釋。所以你必須添加[mapView deselectAnnotation:aView.annotation animated:YES];在didSelectAnnotationView委託方法中。

+0

它的工作,非常感謝=) – user2037296

+0

最歡迎:) –

+0

但如果你想在地圖視圖中點擊空白區域,這將無法正常工作。 – user1019042