皆さん。もしよろしければ、助けが必要です。地図ボタンを押すと、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];
}
したがって、最終的なマップビュー アウトレットは、たとえ厳しい座標であっても地域を設定することはできません。ただし、指定したさまざまなスパンを受け入れますが、ユーザー領域では常にロックされています。質問は...なぜですか?