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 o开发者_Python百科utside 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
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];
}
精彩评论