Question

I am working on Google maps,and I am new to it.Actually I want to show navigation symbol on Google maps when I move to position A to position B following the path i have drawn.I want to animate or move the map and compass button direction as I am moving my device without touching it in same direction.Please help me how would i do this.

Thanks.

Was it helpful?

Solution

When the compass changes, it will execute the function and you can change the direction.

You can use the function below.

- (void)locationManager:(CLLocationManager *)manager didUpdateHeading:(CLHeading *)newHeading { 
if (newHeading.headingAccuracy > 0) {
CGFloat heading = (1.0f * M_PI * newHeading.trueHeading) / 180.f;
myLocationAnnotationView.transform = CGAffineTransformMakeRotation(heading);}}

this image illustrates the situation:

enter image description here

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top