the*_*ncs 12 native objective-c ios compass-geolocation
是否可以使用iOS在我自己的应用程序中使用的原生指南针?或者我是否需要绘制自己的指南针并制作动画?
Kel*_*ler 30
没有原生指南针UIView.要使用磁力计,您必须使用CoreLocation和以下委托方法:
- (void) locationManager:(CLLocationManager *)manager
didUpdateHeading:(CLHeading *)newHeading
Run Code Online (Sandbox Code Playgroud)
将UIView旋转到指向North(bearingView是UIImageView):
float heading = newHeading.magneticHeading; //in degrees
float headingDegrees = (heading*M_PI/180); //assuming needle points to top of iphone. convert to radians
self.bearingView.transform = CGAffineTransformMakeRotation(headingDegrees);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
16289 次 |
| 最近记录: |