2017-06-01 65 views
0

我正在使用xamarin ios。我正在使用MKMapView来显示一些位置。我有一些任务和地点(经度,纬度)。我已经在Map上映射了位置,当用户点击注解点时,它显示任务的描述。如何在单一点显示多个注释详细信息?

但是在某些情况下,多个任务可以具有相同的位置,因此在这种情况下,用户在注释点单击时,任务描述会逐个显示。但我希望当用户点击注释点时,该点的所有任务描述应该像列表一样显示。如何在Xamarin ios中可能?

回答

0

使用自定义标注视图来显示所有的任务点的描述:

public override MKAnnotationView GetViewForAnnotation (MKMapView mapView, NSObject annotation) 
{  
     if (annotation is MKUserLocation){ 
      return null; 
     } 

     //Use a custom annotationView instead, which inherited from MKAnnotationView, has a label to display description. 
     ACustomMKAnnotationView annotationView = mapView.DequeueReusableAnnotation (annotationId); 

     if (annotationView == null) { 
      annotationView = new ACustomMKAnnotationView (annotation, annotationId); 
     } 

     annotationView.descriptionLabel.text = "All the task description joined"; 
     annotationView.CanShowCallout = true; 

     return annotationView; 
} 

采取从参考:https://developer.xamarin.com/guides/ios/platform_features/ios_maps_walkthrough/