Rotate MapView using Compass orientation

后端 未结 5 1669
故里飘歌
故里飘歌 2020-12-16 04:57

Is it possible to have an embedded MKMapView rotate to always face the direction the iPhone is facing? Basically I want to mimic the Map app rotation feature o

5条回答
  •  眼角桃花
    2020-12-16 05:57

    I can confirm that it works fine. Here's the code that I'm using:

    [mapView setTransform:CGAffineTransformMakeRotation(-1 * currentHeading.magneticHeading * 3.14159 / 180)];
    

    mapView is my MKMapView instance

提交回复
热议问题