1:CLLocationDegrees 经纬度
CLLocationDegrees latitude = theLocation.coordinate.latitude;
CLLocationCoordinate2D coordinate = theLocation.coordinate
CLLocationDegrees longitude = theLocation.coordinate.longitude;
2:CLLocationAccuracy 精度
有四个值:kCLLocationAccuracyBestForNavigation,kCLLocationAccuracyBest,
kCLLocationAccuracyNearestTenMeters,kCLLocationAccuracyHundredMeters
kCLLocationAccuracyKilometer,kCLLocationAccuracyThreeKilometers
3:MKCoordinateSpan span = MKCoordinateSpanMake(0.1, 0.1);//显示比例
MKCoordinateRegion region = MKCoordinateRegionMake(coordinate, span);//定义地图区域
4:MKMapView
MapType属性值 描述
MKMapTypeStandard 表示标准的街道级地图
MKMapTypeSatellite 表示卫星图
MKMapTypeHybird 表示上面两者的混合
5:计算两点间的位置:单位(千米)
[NSString stringWithFormat:@"%0.2f km",[userLocation getDistanceFrom:location]/1000]
6:在处理MKAnnotationView时,都要判断对应annotation是不是MKUserLocation这个显示用户当前位置的蓝点,以避免误 操作。[annotation isKindOfClass:[MKUserLocation class]]
7:- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation
这个delegate函数一般会在给MKMapView对象添加 annotations后马上执行,但执行不会马上结束。如果在它完成之前就调用8:MKMapView放大缩小时,需要注意的是放大,至少放大2倍以上才会被执行。
MKCoordinateRegion region = mMapView.region;
region.span.latitudeDelta=region.span.latitudeDelta * 0.4;
region.span.longitudeDelta=region.span.longitudeDelta * 0.4;
[mapView setRegion:region animated:YES];(放大)
MKCoordinateRegion region = mMapView.region;
region.span.latitudeDelta=region.span.latitudeDelta * 1.3;
region.span.longitudeDelta=region.span.longitudeDelta * 1.3;
[mapView setRegion:region animated:YES];(缩小)