TL; DR如何围绕y轴获得iPhone的旋转,每秒左右更新一次.
解决方法 导入CoreLocationclass VIEwController: UIVIEwController,CLLocationManagerDelegate { var lm:CLLocationManager! overrIDe func vIEwDIDLoad() { super.vIEwDIDLoad() lm = CLLocationManager() lm.delegate = self lm.startUpdatingheading() } overrIDe func dIDReceiveMemoryWarning() { super.dIDReceiveMemoryWarning() } func locationManager(manager: CLLocationManager!,dIDUpdateheading newheading: CLheading!) { println(newheading.magneticheading) }}
您可以从https://developer.apple.com/library/ios/documentation/CoreLocation/Reference/CLHeading_Class/获取更多信息
总结以上是内存溢出为你收集整理的ios – 快速查找iPhone的指南针方向全部内容,希望文章能够帮你解决ios – 快速查找iPhone的指南针方向所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)