tags:

views:

25

answers:

1

Hi all,

I am working on a map application in iPhone. While loading the MapViewController the map is not loaded automatically in the mapView, When we drag the mapView the area outside the intial view is loaded. Also when we double tap on the map it get start loading. Can anybody help me fixing this.?

Thanks in Advance,

Shibin

+2  A: 

Try putting the next lines in the viewDidLoad of the view controller:

CLLocation *location;// Get the location from location manager
if (location) {
    MKCoordinateRegion region = MKCoordinateRegionMake(location.coordinate, MKCoordinateSpanMake(0.02, 0.02));  

    [self.mapView setRegion:region animated:TRUE];
    [self.mapView regionThatFits:region];
}
Michael Kessler
Thanks Michael, It works.
Shibin Moideen