Map Events
Change the Zoom Level
The map supports zoom levels from 3 to 19, for a total of 17 levels. Call the setZoomLevel method on MAMapView to adjust the zoom level and scale the map.
[_mapView setZoomLevel:17.5 animated:YES];Change the Center Point
When panning the map, the zoom level remains unchanged. You can move the map by changing its center point.
[_mapView setCenterCoordinate:center animated:YES];Restrict the Map Display Area
> Note: This feature was introduced in v4.4.0.
You can set a display boundary so that the map screen shows only the specified geographic area. This feature does not currently support rotated maps, so use it together with the "disable rotation gesture" setting.
Use case: Display a fixed portion of the map, such as showing only the Beijing city area.
Implementation:
_boundary = MACoordinateRegionMake(CLLocationCoordinate2DMake(40, 116), MACoordinateSpanMake(2, 2));
MAMapRect mapRect = MAMapRectForCoordinateRegion(_boundary);
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
// Important: Do not set this in viewWillAppear
[self.mapView setLimitRegion:self.boundary];
}