When I try to move my MKPointAnnoatation like this:
[UIView animateWithDuration:0.5 animations:^{
[user setCoordinate:coordinate];
The pin disappears on the map :( Is there a different solution to move a MKPointAnnotion?
EDIT MORE CODE:
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];