我在其他应用程序(例如 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;