1、创建地图,显示用户定位:
_mapView = [[MKMapView alloc]init];
_mapView.userTrackingMode = MKUserTrackingModeFollow;
_mapView.mapType = MKMapTypeStandard;
_mapView.showsUserLocation = YES;
//用户定位追踪:
self.locationManger = [[CLLocationManager alloc]init];
[self.locationManger requestAlwaysAuthorization];
[self addSubview:_mapView];
2、导航:
(1)、苹果导航:
//苹果导航:
- (void)appleRoad{
MKMapItem *currentLocation = [MKMapItem mapItemForCurrentLocation];
_geocoder = [[CLGeocoder alloc]init];
[_geocoder geocodeAddressString:self.address completionHandler:^(NSArray<CLPlacemark *> * _Nullable placemarks, NSError * _Nullable error) {
CLPlacemark *placemark = placemarks.firstObject;
CLLocation *loc = placemark.location;
self.coordinate=CLLocation