I want to show an arrow image on GMSMapView(i am using google maps sdk). Now if i am driving(arrow is showing my current location) and i have to take left turn then i have to change bearing of mapView. But i have no idea how to do this.
I am trying to change bearing in didUpdateHeading
- (void)locationManager:(CLLocationManager *)manager didUpdateHeading:(CLHeading *)newHeading{
if(newHeading.headingAccuracy>0)
{
float heading = newHeading.magneticHeading; //in degrees
//heading = (heading*M_PI/180);
//NSLog(@"heading=%f", heading);
[mapView animateToBearing:heading];
}}
headingFilter is set to 12.
I have also tried trueHeading, but magneticHeading is giving better results not accurate though.
Please help.
[Your CLLocationManager instance].desiredAccuracy = kCLLocationAccuracyBestForNavigation
? – Brainy