Showing an arrow that is heading a specific location
-
16-10-2019 - |
Question
Does anyone know how to place out an arrow that points to a specific annotation depending on my current heading. For example; I want the arrow to be vertical when the current heading is the same as the annotation's coordinates. I am offering 50$ to the one doing this thing for me via paypal Have a look at the picture below;
.
Solution
Sounds like you're trying to do the same thing as Using lattitude and longitude of the current location and destination location , how can we get the direction in iphone get the heading between your current position and some destination, then compare that heading with your current heading to determine which direction that arrow should face.
OTHER TIPS
Can't you set the arrows rotation using on screen coordinates and then rotate the view containing the map and the arrow, so that north is always up?
You can try something like:
- (void) updateHeading
{
[locationManager startUpdatingHeading];
locationManager.headingFilter = kCLHeadingFilterNone;
}
- (void) locationManager:(CLLocationManager*)manager didUpdateHeading:(CLHeading*)newHeading
{
heading = newHeading.trueHeading;
heading += -90.0 * roll;
NSLog(@"Your Heading: %@", heading);
NSLog(@"magneticHeading: %f", newHeading.magneticHeading);
NSLog(@"trueHeading: %f", newHeading.trueHeading);
}
Also, see magneticHeading
and truHeading
in the CLHeading Class Reference