I am showing the current location
in MKMapView
by using showUserLocation
enables. I also want to center the mapview
to the us
MKCoordinateRegion region;
MKCoordinateSpan span;
span.latitudeDelta = 0.2; // 0.0 is min value u van provide for zooming
span.longitudeDelta= 0.2;
CLLocationCoordinate2D location = [self addressLocation];
region.span=span;
region.center =location; // to locate to the center
if(addAnnotation != nil) {
[mapView removeAnnotation:addAnnotation];
[addAnnotation release];
addAnnotation = nil;
}
addAnnotation = [[AddressANnotation alloc] initWithCoordinate:location];
[mapView addAnnotation:addAnnotation];
[mapView setRegion:region animated:TRUE];
[mapView regionThatFits:region];
This had help me to show the position at the center of the map view.