Hello everyone i was wondering how to rotate an arrow i.e uiimageview according to 2 coordinates. I already have coordinate A latitude & longitude and also coordinate B latitude & longitude. I dot want to use location manager start updating header since I already have my start & end coordinates. Thank you :)
Asked
Active
Viewed 150 times
0
-
1Have you googled it? Have a look at this question: http://stackoverflow.com/questions/3809337/calculating-bearing-between-two-cllocationcoordinate2ds – Mikael May 24 '13 at 09:28
-
Check my answer on -- http://stackoverflow.com/questions/16730770/with-what-coordinates-do-i-use-to-manually-draw-a-custom-path-with-an-mkmapview/16731483#16731483 – May 24 '13 at 09:31
1 Answers
0
This will give you the direction in radiants
radiants = arctan((latB-latA)/(lonB-LonA))
You can convert it to degrees with
degrees = (radiants*180)/π

gtsouk
- 5,208
- 1
- 28
- 35