在ios

时间:2016-11-18 07:31:28

标签: objective-c mkmapview

在我的项目中,我需要在地图中显示我的用户从头到尾的汽车移动动画的行进路径。我已经展示了这些地点和成功绘制一条路线。

  

现在我想要从头到尾动画或移动注释。

我在下面的代码中尝试移动注释。

- (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];
    }
}

在此我添加了所有位置&amp;画了路线(绿线)

enter image description here

这是当我点击移动注释但我从其他地方来的时候。

enter image description here

0 个答案:

没有答案
相关问题