MapKit 和 CoreLocation

时间:2014-02-23 07:27:00   收藏:0   阅读:320

    实战应用

 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

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

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!