首页 > 其他 > 详细

MapKit 和 CoreLocation

时间:2014-02-23 07:27:00      阅读:320      评论:0      收藏:0      [点我收藏+]

    实战应用

 1.首先导入两个包 MapKit.framework 和 CoreLocation.framework.

// 1. 实例化定位管理器

_locationManager = [[CLLocationManager alloc] init];

// 2. 设置代理

_locationManager.delegate = self;

// 3. 定位精度

[_locationManager setDesiredAccuracy:kCLLocationAccuracyBest];

// 4. 更新用户位置

[_locationManager startUpdatingLocation];

?当用户的位置发生改变时,就会不断调用代理方法,比如

- (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations

?
?当定位失败时,会调用

- (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error

MapKit 和 CoreLocation

原文:http://www.cnblogs.com/weizai123/p/3561202.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!