我已经查看了现有的问题,并相信我遵守了规则,但出于某种原因,我的地图没有缩放。我已经设置了一个断点,以确保我的坐标可以通过并且那里的一切似乎都正常。
下面是我的代码。
- (void)viewDidLoad
{
[super viewDidLoad];
[self configureView];
mapView = [[MKMapView alloc]initWithFrame:CGRectMake(20, 20, 260, 169)];
mapView.delegate = self;
mapView.mapType = MKMapTypeStandard;
[self.view addSubview:mapView];
}
- (void)mapView:(MKMapView *)mapView regionWillChangeAnimated:(BOOL)animated {
Bar *maps = self.detailItem;
MKCoordinateSpan span;
span.latitudeDelta = .02;
span.longitudeDelta = .02;
CLLocationDegrees latDegree = [maps.barLat doubleValue];
CLLocationDegrees longDegree = [maps.barLong doubleValue];
CLLocationCoordinate2D location = CLLocationCoordinate2DMake(latDegree, longDegree);
MKCoordinateRegion region;
region.center = location;
region.span = span;
[mapView setRegion:region animated:TRUE];
}