2009-12-19 125 views
0

如何從指南針校準獲得的方向, 我使用的核心位置框架,不知道如何從功能得到正北方向:指南針校準問題

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

如果有人知道幫我弄的解。

回答

4

的方法是合適的。您可以磁性和真航向之間chosse。

- (void)locationManager:(CLLocationManager *)manager didUpdateHeading:(CLHeading *)newHeading{ 
    float compassHeading_True = newHeading.trueHeading; 
    float compassHeading_Magnetic = newHeading.magneticHeading; 
} 

如果你想允許指南針校準,你必須實現這個方法:

- (BOOL)locationManagerShouldDisplayHeadingCalibration:(CLLocationManager *)manager{ 
return YES;}