CLLocation 定位
来源:互联网 发布:js获取子节点多一个 编辑:程序博客网 时间:2024/06/10 19:09
CLLocationManager *manager = [[CLLocationManager alloc]init];
manager.delegate = self;
manager.desiredAccuarcy = KCLLocationAccuracyBest;
manager.distanceFilter = 100.0f;
注释:desiredACCuarcy 是定位的精准度,有以下几个属性:KCLLocationAccuracyNearestTenMeters 表示精准度到10米
KCLLocationAccuracyNearestHundred 表示精准度到100米
KCLLocationAccuracyNearestkilometer 表示精准度到1000米
KCLLocationAccuracyNearestThreeKilome 表示精准度到3000米
KCLLocationAccuracyNearestBest 表示设备使用电池供电时可达到的最大精度
KCLLocationAccuracyNearestBestForNavigation 导航时的最高精度,一般需要外接电源才可使用
distanceFilter 设备多少距离之后开始更新位置信息,单位是米
[manager startUpdatingLocation] // 开始测位
[manager stopUpdatingLocation] //结束测位
[manager allowDeferredLocationUpdatesUntilTraveled:(CLLocationDistance) timeout:(NSTimeInterval)] //设置延迟更新,使应用在后头不更新位置
[manager disallowDeferredLocationUpdates] //关闭延迟更新
[manager pausesLocationUpdatesAutomatically] //将定位服务的开启和暂停交个系统
当用户的设备达到过滤距离的时候会调用:-(void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations //取得位置更新信息
和-(void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error //未取得位置信息
取得经纬度方法: CLLocation *m_location = [locations lastObject];
textfield.text = [NSString stringWithFormat:@"%3.5f",m_location.coordinate.longitude ]; //纬度
textfield1.text = [NSString stringWithFormat:@"%3.5f",m_location.coordinate.latitude]; //经度
textfield2.text = [NSString stringWithFormat:@"%3.5f",m_location.altitude]; //高度
ps: 参考《ios网络编程与云端应用》一书
- CLLocation 定位
- 定位CLLocation
- CLLocation定位
- 地图定位CLLocation详解
- 用CLLocation定位(iOS)
- iOS定位-核心定位框架CLLocation
- CLLocation
- CLLocation
- ios8之后的CLLOCATION定位权限申请
- 关于CLLocation定位中CLGeocoder报错的问题
- ios CLLocation定位坐标转换成ArcGIS坐标点
- 关于ios定位bug CLLocation 报错 The operation couldn’t be completed
- CLLocation学习
- iOS CLLocation
- 100 CLLocation
- IOS CLLocation基础
- iOS CLLocation对象详解
- iPhone 通过CLLocation 取得当前位置
- onDraw 中使用canvas画线
- appium搭建及要求---在 Mac 上配置 Appium
- 嵌入式linux 随笔
- kettle部署到linux服务器
- leetcode Longest Valid Parentheses
- CLLocation 定位
- Android Design版微信的界面风格
- c# 扑克牌程序(1) 一副扑克牌可以选择是否包含大小王
- Collections.unmodifiableList()用法
- C# 属性和公有变量区别
- OpenGL ES2.0 学习之旅(Pre 1)
- JDBC SQL组装 显示标识符无效
- PreferencesUtils
- 苹果将要推出大屏幕版的iPhone