I use the following delegate method to draw route on Map. It works fine most of the time except in one route that has large coordinates array. Sometimes it can cast the MKOverlay to MKPolyline and sometimes it cannot for the same route. Any idea why this is happening?
public override MKOverlayView GetViewForOverlay (MKMapView mapView, IMKOverlay overlay)
{
if (overlay is MKPolyline) {
MKPolyline polyline = overlay as MKPolyline;
MKPolylineView polylineView = new MKPolylineView (polyline);
polylineView.StrokeColor = UIColor.Blue;
polylineView.LineWidth = 5.0f;
return polylineView;
}
return null;
}