How to show the compass on the screen?

I am new to iOS development. My goal is to show the compass on the screen. I have the latitude and longitude of a particular place. I got my current latitude and longitude using CLLocation.

I calculated the distance between two points using the API, but now I want to know the correct direction of my N / S / E / W phone and something like the right north pole ... I'm not sure.

Is there some kind of concept for the iPhone North Pole and the actual North Pole?

I want to show a line indicating a specific longitude and latitude, even if my phone rotates or moves; the line points only to this point.

Please help me, where should I go next? Any directions or links / tet will be great.

+5
source share
1 answer

This is called the CLLocation header.

See the CLLocationManager part of the document to customize the title for your application and call startUpdatingHeadingto receive notifications of changes in the title, namely when your iPhone points to another point.

Then use standard methods CLLocationManagerDelegateto report heading changes and redraw your line accordingly.

, , .


PS: "iPhone ", iPhone. : , , .

( , " ", ):

. , . , . , , .

+6

All Articles