I am showing the current location in MKMapView by using showUserLocation enables. I also want to center the mapview to the user current location and also the zoomed map of location. Please help me regarding this as I don’t get any help from other similar questions on stackoverflow.
My code is below:
- (void)viewDidLoad {
[super viewDidLoad];
[mapView setMapType:MKMapTypeStandard];
[mapView setZoomEnabled:YES];
[mapView setScrollEnabled:YES];
[mapView setCenterCoordinate:mapView.userLocation.location.coordinate animated:YES];
[mapView setDelegate:self];
}
For centering on user location, you can use the following code:
For zooming on special locations, you should study how the regions (
MKCoordinateRegion) are counted and work, count your values for the region and display it using call:This sample WorldCities shows basics of region displaying.