嗨,伙计们。如果你可以的话,我需要一些帮助。当我按下地图按钮时,我通过 CLLocation 属性加载了一个具有经度和纬度的对象。问题是,我不希望地图将区域/中心坐标设置为用户位置,我希望它在地图加载后进入注释区域,所以我这样做:
- (void)loadActiveEstateAnnotation
{
RE_Annotation *re_annotation = [[RE_Annotation alloc] init];
if(self.mapView.showsUserLocation == YES)
NSLog(@"Santa Clause is comming to town");
re_annotation.longitude = viewingEstate.estateLocation.coordinate.longitude;
re_annotation.latitude = viewingEstate.estateLocation.coordinate.latitude;
re_annotation.poiID = [[RE_Shared sharedInstance] selectedEstate];
re_annotation.title = [NSString stringWithFormat:@"Estate %d",re_annotation.poiID];
[self.mapView addAnnotation:re_annotation];
CLLocationCoordinate2D activeAnnotationCoordonate;
activeAnnotationCoordonate.longitude = re_annotation.longitude;
activeAnnotationCoordonate.latitude = re_annotation.latitude;
MKCoordinateSpan activeEstateSpan;
activeEstateSpan.longitudeDelta = 0.05;
activeEstateSpan.latitudeDelta = 0.05;
MKCoordinateRegion activeEstateRegion;
activeEstateRegion.center = activeAnnotationCoordonate;
activeEstateRegion.span = activeEstateSpan;
NSLog(@"----These are the coordinates%f,%f", activeAnnotationCoordonate.longitude, activeAnnotationCoordonate.latitude); // coordinates are good and valid ive checked them
[self.mapView setRegion:activeEstateRegion];
[self.mapView regionThatFits:activeEstateRegion];
[re_annotation autorelease];
}
所以底线地图视图出口不是设置区域,即使坐标也很好。但是,它确实接受了我给它的不同跨度,但它仍然始终锁定在用户区域;问题是……为什么?