Вы можете использовать любой из методов в MKMapView
// You specify lat,lng as coordinate and the map centers around it
- (void)setCenterCoordinate:(CLLocationCoordinate2D)coordinate animated:(BOOL)animated
// You specify a region (center lat,lng and span) and the map centers and zooms appropriately
- (void)setRegion:(MKCoordinateRegion)region animated:(BOOL)animated
Так, например, в вашем классе TableViewDelegate
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
CLLocationCoordinate2D coordinate = ... // Obtain coordinate from selected index path
YourMapViewController * controller = ... // initialize YourMapViewController
// Your YourMapViewController class has to implement coordinate property as CLLocationCoordinate2D
controller.coordinate = coordinate;
// This is an example case you are using navigation controller, it can be modal transition as well.
[self.navigationController pushViewController:controller animated:YES];
}
Ваш класс YourMapViewController должен реализовать CLLocationCoordinate2D coordinate
имущество.А в viewDidLoad вам нужно вызвать метод senterCoordinate...
для mapView
, чтобы центрировать карту.
- (void) viewDidLoad {
[super viewDidLoad];
...
[mapView setCenterCoordinate:self.coordinate animated:NO];
}