We found that map and location functions are introduced in many social software. If we want to implement these two functions, we need to use two frameworks: Let's first look at the frameworks: and the frameworks:
[_mapView setUserTrackingMode:MKUserTrackingModeFollow];
Map type You can set the map type MKMapTypeStandard common map MKMapTypeSatellite satellite cloud map by setting the mapViewType of MKMapView. The MKMapTypeHybrid common map covers the satellite cloud map.
[_mapView setMapType:MKMapTypeHybrid];
2.2.1.mapViewWillStartLoadingMap: called when the map interface is to be loaded
2.2.2.mapView: viewForAnnotation: called when a pin is displayed on the local graph.
2.2.3.mapViewWillStartLocatingUser: called when a location is to be located.
2.2.4.mapView: regionDidChangeAnimated: called when the display area changes
_mapView. = self;
Mark-map proxy method mark is frequently called, which is very expensive-() mapView :( MKMapView *) mapView didUpdateUserLocation :( MKUserLocation * sets the map display area
CLLocationCoordinate2D center = userLocation. location. coordinate;
MKCoordinateRegion region = MKCoordinateRegionMakeWithDistance (center, 100.0, 100.0 );
[MapView setRegion: region animated: YES];
1. you can add a pin to the map through the addAnnotation method of MapView. you can add multiple pins to the map by using the addAnnotations method of MapView. 4. indicates that an object that complies with the MKAnnotation Protocol needs to be input.
MyAnnotation *annotation2 = annotation2.coordinate = CLLocationCoordinate2DMake(, annotation2.title = annotation2.subtitle = annotation2.imageName = ;
[_mapView addAnnotation:annotation2];
Mark custom pin view-(MKAnnotationView *) mapView :( MKMapView *) mapView viewForAnnotation :( <MKAnnotation> (! [Annotation comment: [MyAnnotation NSString * ID = MKAnnotationView * annoView = (annoView = annoView. Comment = annoView. annotation = MyAnnotation * anno = annoView. image = NSLog (}
CLLocationManager * CLGeocoder *_geocoder;
LocationServicesEnabled
(! NSLog(
[_ LocationManager startUpdatingLocation];
- ()locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray * NSLog(, locations[ [_geocoder reverseGeocodeLocation:locations[] completionHandler:^(NSArray *placemarks, NSError * NSLog(, placemarks[ }
[_geocoder geocodeAddressString: completionHandler:^(NSArray *placemarks, NSError * (CLPlacemark *placemark NSLog(, placemark, (unsigned }];