2

所以我在我的视图控制器中添加了一个 UIMap 并将其链接到“mapView”参考。坐标也可以在地图上完美运行。但是,我无法将地图缩放到坐标!我究竟做错了什么?

CLLocationCoordinate2D _coords = CLLocationCoordinate2DMake(lat, lon); //lat and lon are previously declared location values
MKCoordinateRegion adjustedRegion = [mapView regionThatFits:MKCoordinateRegionMakeWithDistance(_coords, 250, 250)];
[self.mapView setRegion:adjustedRegion animated:YES]; //I have tried this with and without the self
 self.mapView.delegate = self;  
MKPointAnnotation *annotationPoint = [[MKPointAnnotation alloc] init];
annotationPoint.coordinate = _coords;
annotationPoint.title = @"George's House";
[mapView addAnnotation:annotationPoint];
 [mapView selectAnnotation:annotationPoint animated:YES];
4

0 回答 0