他のアプリケーションで見たことがあります。例:iOS 6スターバックス、マップビューを開いたときに、その地域を英国/イギリス諸島全体として表示したいので、指定した場所の地域ポイントにズームインしたいです。 。
更新されたコード:
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
[mapView setMapType:MKMapTypeStandard];
[mapView setZoomEnabled:YES];
[mapView setScrollEnabled:YES];
MKCoordinateRegion region = { {0.0, 0.0 }, { 0.0, 0.0 } };
region.center.latitude = 54.5;
region.center.longitude = -3.5;
region.span.longitudeDelta = 10.0f;
region.span.latitudeDelta = 10.0f;
[mapView setRegion:region animated:NO];
[self performSelector:@selector(zoomInToMyLocation)
withObject:nil
afterDelay:2]; //will zoom in after 1.5 seconds
}
-(void)zoomInToMyLocation
{
MKCoordinateRegion region = { {0.0, 0.0 }, { 0.0, 0.0 } };
region.center.latitude = 51.502729 ;
region.center.longitude = -0.071948;
region.span.longitudeDelta = 0.19f;
region.span.latitudeDelta = 0.19f;
[mapView setRegion:region animated:YES];
[mapView setDelegate:self];
[self performSelector:@selector(selectAnnotation)
withObject:nil
afterDelay:0.5]; //will zoom in after 0.5 seconds
}
-(void)selectAnnotation
{
DisplayMap *ann = [[DisplayMap alloc] init];
ann.title = @"Design Museum";
ann.subtitle = @"Camberwell, London";
ann.coordinate = region.center;
[mapView addAnnotation:ann];
}
エラーはこの行なので、正しいかどうかわからない
ann.coordinate = region.center;