Ios 为MKPointAnnotation设置新坐标时,销消失
当我尝试像这样移动我的MkPointAnnoation时:Ios 为MKPointAnnotation设置新坐标时,销消失,ios,objective-c,mkpointannotation,Ios,Objective C,Mkpointannotation,当我尝试像这样移动我的MkPointAnnoation时: [UIView animateWithDuration:0.5 animations:^{ [user setCoordinate:coordinate]; pin在地图上消失:(移动MKPointAnnotion是否有其他解决方案 编辑更多代码: CLLocationCoordinate2D *plotLocation = malloc(sizeof(CLLocationCoordinate2D) *
[UIView animateWithDuration:0.5 animations:^{
[user setCoordinate:coordinate];
pin在地图上消失:(移动MKPointAnnotion是否有其他解决方案
编辑更多代码:
CLLocationCoordinate2D *plotLocation = malloc(sizeof(CLLocationCoordinate2D) *
_trak.trakTagRelationship.count);
int i=0;
for (TrakTag* tag in _trak.trakTagRelationship)
{
CLLocationCoordinate2D coordinate = CLLocationCoordinate2DMake(tag.trakTagX.doubleValue,
tag.trakTagY.doubleValue);
plotLocation[i] = coordinate;
i++;
}
TrakTag* dummy = [[_trak.trakTagRelationship allObjects]lastObject];
CLLocationCoordinate2D coordinate = CLLocationCoordinate2DMake(dummy.trakTagX.doubleValue,
dummy.trakTagY.doubleValue);
if (user != NULL)
{
[UIView animateWithDuration:0.5 animations:^{
[user setCoordinate:coordinate];
NSLog(@"Annotaions:%@",user);
}];
}
else
{
user = [[MKPointAnnotation alloc]init];
[user setCoordinate:coordinate];
[mapView addAnnotation:user];
}
line = [MKPolyline polylineWithCoordinates:plotLocation count:_trak.trakTagRelationship.count];
[mapView addOverlay:line];
你试过在没有动画的情况下设置坐标吗?成功了吗?没有动画我也会遇到同样的问题。你确定坐标适合可见区域吗?你的跨度是多少?坐标是多少?坐标是(54.f,8.f)和(55.f,8.f)。是的,坐标适合该区域。