In my project i need to show my user travelled path from start to end with car moving animation in map. I already show those locations & draw a route line successfully.
Now i want to animate or move the annotation from start to end.
I tried below code to move the annotation.
- (IBAction)btnClick:(id)sender {
MKPointAnnotation *point=[[MKPointAnnotation alloc]init];
[self animateAnnotation:point];
}
-(void) animateAnnotation:(MKPointAnnotation*)annotation{
CLLocationCoordinate2D newCordinates;
for(int i=0;i<latArr.count;i++){
newCordinates=CLLocationCoordinate2DMake([latArr[i] doubleValue], [longArr[i] doubleValue]);
[UIView
animateWithDuration:2.0
delay:2.0
options:UIViewAnimationOptionCurveEaseInOut
animations:^{
annotation.coordinate = newCordinates;
}
completion:nil];
}
}
In this i added all locations & drawed the route(greenline)
This when i click the move annnotaion but i comming from some other locations.