- (void)reverseGeocoder:(MKReverseGeocoder *)geocoder didFailWithError:(NSError *)error{
}
- (void)reverseGeocoder:(MKReverseGeocoder *)geocoder didFindPlacemark:(MKPlacemark *)placemark{
NSLog(@"Geocoder completed");
mPlacemark=placemark;
[mapView addAnnotation:placemark];
}
- (void)viewDidLoad {
mapView = [[MKMapView alloc] initWithFrame:self.view.bounds];
mapView.mapType = MKMapTypeStandard;
CLLocationCoordinate2D coord;
coord.latitude=37.505675;
coord.longitude=126.953167;
MKCoordinateSpan span = {latitudeDelta: 0.01, longitudeDelta: 0.01}; //size of map
MKCoordinateRegion region = {coord, span};
[mapView setRegion:region];
[self.view insertSubview:mapView atIndex:0];
NSArray *annotations = [NSArray arrayWithArray:[mapView annotations]];
[mapView removeAnnotations:annotations];
MKReverseGeocoder *geocoder=[[MKReverseGeocoder alloc] initWithCoordinate:coord];
geocoder.delegate=self;
[geocoder start];
}
댓글 달기