100grams / moving-mkannotationview Goto Github PK
View Code? Open in Web Editor NEWAn implementation of a moving map annotation using iOS MapKit and QuartzCore.
An implementation of a moving map annotation using iOS MapKit and QuartzCore.
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 ;-)
I want to add cars on the map and show their movement but the problem is that I am getting the position of cars from an api.So I want to animate cars through the latitude and longitude that I am getting from that api.How can I achieve that?Any help will be much appreciated.
Hi,
Thanks a lot for the Post Moving MKAnnotationView. Its very helpful and its been used by many. I came across a similar kind of requirement where i need to animate the annotation points between multiple map points. I was able to do it with the post u have suggested but apart from that i need to stop the animation at certain annotation points and wait for 2 seconds and then start the animation again. Can you please help me? It would be of great help if any alternative or suggestion is provided for this..
@100grams In ios 7 annotation is blinking when move and not shows soft animation like ios 6.
When the map region changes, the "moving" pin is dragged with the slide and then returns to its place to continue moving... any ideas how to fix the pin when the user changes the region of the map? Thanks!
Hi Rotem,
From your yesterday's answer i have got an understanding on how this should be done. But my problem here lies in when the annotation point where it should stop at a particular point and then resume from that stopped point. HGMovingAnnotation Class has a "Stop" Method but when i tried to call the Stop method from "startTracking" Method it doesn't get called. I am actually checking the condition if the currentLocation reaches certain location coordinates.
double latitude = currentLocation.x;
double longitude = currentLocation.y;
if (latitude == 137472336.403570 && longitude == 90052702.711254 ) {
NSLog(@"Inside If condition");
[self stop];
}
Can you please suggest me an alternative on how to implement this?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.