Vinay Jain
Vinay Jain

Reputation: 2634

MKMapView should always head towards the moving direction

I want to accomplish the following:

When user is moving on the MKMapView, the MapView should always head to the moving direction of the user. As user will change his direction the map view should rotate itself and again heads to the moving direction of user.

I have used MKUserTrackingModeFollowWithHeading, but it is working with compass. I dont want to use compass here as it is not fulfilling what i want to implement.

I found Waze app doing exactly the same i want to do. Anyone have an idea or solutions to implement this behaviour. Any help will be highly appreciated. Thanks in advance.

Upvotes: 0

Views: 95

Answers (1)

Caleb
Caleb

Reputation: 124997

Sure. Just keep the user's location centered in the map view, and compute a heading based on the last two known positions. Use that heading to orient the map.

Upvotes: 1

Related Questions