关于MKMapView&CLLocationManager的一些记录

显示自己的位置:

1,在属性检查器里勾选show user location

2,或者通过_mapView.showsUserLocation = YES将属性设置为YES;

3,self.map.mapType = MKMapTypeStandard;

    self.map.mapType = MKMapTypeSatellite;

    self.map.mapType = MKMapTypeHybrid;

    设置地图样式

CLLocationManager使用时的基本设置:

_locationManager.delegate = self;

 _locationManager.desiredAccuracy = kCLLocationAccuracyBest;设置多远距离刷新一次位置

开启定位功能:[_locationManager startUpdatingLocation];

关闭定位功能:[_locationManager stopUpdatingLocation];

设置地图显示比率:[_mapView setRegion:region animated:YES];

到某个位置的距离[newLocation  distanceFromLocation:_startPoint];

error.code == kCLErrorDenied判断刷新失败的原因是不是用户拒绝开启定位功能 ,未知原因为kCLErrorLocationUnknown

老师为显示的问题是因为

 if (newLocation.verticalAccuracy < 0 || newLocation.horizontalAccuracy < 0) {

        // invalid accuracy

        return;

    }

    

    if (newLocation.horizontalAccuracy > 100 || newLocation.verticalAccuracy > 50) {

        // accuracy radius is so large, we don't want to use it

        return;

    }

这个判断语句,导致了大头钉位置标签未显示

转载于:https://my.oschina.net/u/1432769/blog/199184

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值