I add an overlay (array of multiple coordinates) and draw a path.
It works perfectly, but I would like (if it's possible), to draw the path with an animation (coordinate by coordinate, or fade in, etc.)
My app is only on iOS 7 or later.
Here my methods:
- (void)drawPathWithAnnotations:(NSArray*)annotations
{
CLLocationCoordinate2D array[[annotations count]];
for (CLLocation *loc in annotations)
{
array[[annotations indexOfObject:loc]] = CLLocationCoordinate2DMake(loc.coordinate.latitude, loc.coordinate.longitude);
}
self.routeLine = [MKPolyline polylineWithCoordinates:array count:[annotations count]];
[self.mapview addOverlay:self.routeLine];
}
- (MKOverlayRenderer *)mapView:(MKMapView *)mapView rendererForOverlay:(id<MKOverlay>)overlay
{
if(overlay == self.routeLine){
MKPolylineRenderer* lineView = [[MKPolylineRenderer alloc] initWithPolyline:self.routeLine];
lineView.strokeColor = UIColorFromRGB(kAppTintColor);
lineView.lineWidth = 3;
return lineView;
}
return nil;
}
- (void)mapView:(MKMapView *)mapView didAddOverlayRenderers:(NSArray *)renderers
{
// Animation here ?
}
Thank you, any suggestions or ideas are appreciated! :)