views:

367

answers:

1

on the iPhone 3GS in the "Maps" app you can click the icon which usually shows your position twice and the blue dot gains what looks like a beam from a headlamp, basically showing you the direction you are facing on the map and rotating the image accordingly.

Is this option available using MapKit MapView ?

I'm know that I can get my heading with something like

- (void)locationManager:(CLLocationManager *) manager didUpdateHeading:(CLHeading *) newHeading {

// If the accuracy is valid, process the event.

if (newHeading.headingAccuracy > 0) {

    CLLocationDirection theHeading = newHeading.magneticHeading;
    ...
}

}

but I don't know how to get that nice headlamp effect in Mapkit and there doesn't seem to be any documentation.

Any ideas?

+1  A: 

I could think of one method, though i have not implemented but may help you u a bit.

  1. Firstly u need an image with a pointer of ur choice, this pointer must be pointing Upwards 90degree.
  2. Now In your MapKit off the Current Location Marker.
  3. In your didUpdateHeading use the x and y values to calculate the angle of the direction.
  4. Use this angle to rotate the image of the pointer
  5. Use this rotated image as a Annotation Pin in your map.
  6. You would require to update the position of the pointer frequently.

Please post your suggestions/changes for the above approach.

Thanks

RVN