title: How to rotate a Direction Arrow to particular location
body: <p>In my app I have a latitude-longitude of 1 fix location. Now user with iPhone device can move anywhere and even he rotate his device, the arrow (some uiimageview) should point to that fix location so User will get direction to that location every time. I tried as follows.</p>
  
  <pre><code>-(void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation {
  
  CLLocationCoordinate2D here =  newLocation.coordinate;
  [self calculateUserAngle:here];
  }
  
  
  -(void) calculateUserAngle:(CLLocationCoordinate2D)user {
      NSLog(@"my destination is %f ; %f", fixlocLat, fixlocLon);
      degrees =  degrees + atan2(sin(fixlocLon-user.longitude)*cos(fixlocLat),cos(user.latitude)*sin(fixlocLat) - sin(user.latitude)*cos(fixlocLat)*cos(fixlocLon-user.longitude));
  //get angle between user location and fix location
  }
  
  - (void)locationManager:(CLLocationManager *)manager didUpdateHeading:(CLHeading *)newHeading 
  {
      arrow.transform = CGAffineTransformMakeRotation((degrees-newHeading.trueHeading) * M_PI / 180);
  }
  </code></pre>
  
  <p>but the code above will always rotate arrow to approx. 2-3 degree north for every location.</p>
  
  <p>My question looks similar to <a href="https://stackoverflow.com/questions/5092845/point-to-location-using-compass">this Stack Overflow question</a>.but using code from this link I am getting wrong direction. 
  please help me on this.</p>
  
  <p>and also if any idea using accelerometer or gyrodata will be helpful for me.</p>
  
  <p>thanx in advance.</p>