iOS maps show the center of a specific city

Viewed 1649

I am using MapKit and CoreLocation to find the users location and then display it on a map.

I am using this code to display the City and State (which is what I am interested in, not the EXACT location).

// this delegate is called when the app successfully finds your current location
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
{

    CLGeocoder *geocoder = [[CLGeocoder alloc] init] ;
    [geocoder reverseGeocodeLocation:self.locationManager.location
                   completionHandler:^(NSArray *placemarks, NSError *error) {
                       NSLog(@"reverseGeocodeLocation:completionHandler: Completion Handler called!");

                       if (error){
                           NSLog(@"Geocode failed with error: %@", error);
                           return;

                       }


                       CLPlacemark *placemark = [placemarks objectAtIndex:0];

                       CLLocationCoordinate2D zoomLocation;

                       zoomLocation.latitude = placemark.region.center.latitude;
                       zoomLocation.longitude= placemark.region.center.longitude;

                       MKCoordinateRegion viewRegion = MKCoordinateRegionMakeWithDistance(zoomLocation, METERS_PER_MILE * 2, METERS_PER_MILE * 2);

                       [self.mapView setRegion:viewRegion animated:NO];


                       NSString *location = [NSString stringWithFormat:@"%@, %@", placemark.locality, placemark.administrativeArea];

                       NSLog(@"%@", location);

                   }];

}

This works great, but what I really want to do is zoom in to the center of the city itself, not the users location.

Is there some kind of property I can access to do this?

Otherwise, is anyone aware of a work around? That would be great, thanks!

3 Answers
Related