Skip to content

There is a much simpler alternative #5

Open

Description

@malhal

Seems like you did a ton of work trying to solve this problem however you'll find this simple trick of setting the annotation again will cause it to update to the new coordinate:

MKAnnotationView* annotationView = [self.mapView viewForAnnotation:a];
a.coordinate = newCoordinate;
annotationView.annotation = a;

Furthermore if you want to animate the move just do:

[UIView animateWithDuration:0.5 animations:^{
a.coordinate = coordinate;
annotationView.annotation = a;
}];

FYI I saw you setting a mapView on your HGMovingAnnotationView causing a circular reference, tut tut you should be ashamed ;-)

Activity

  1. changed the title [-]Erm sorry for the shock[/-] [+]There is a much simpler alternative[/+] on Apr 26, 2014
  2. primedev-iOS commented on Sep 24, 2014

    @primedev-iOS

    Hey malcolmhall your logic seems alright there.
    Can you please help me for my same problem?
    I am working on app which will animate a annotation from one position to another live.Means I will receive coordinates from server in particular time manner.Please help me I in real trouble.:(

  3. ekimia commented on Jan 26, 2015

    @ekimia

    @MalcolmHall the annotationView.annotation = a; part isn't needed :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions