我在其他應用程序中看到了它exmaple ios 6 starbucks,當我的mapview打開時,我希望它顯示整個英國/英國島嶼的區域,然後我希望它放大到我指定的位置區域點。當mapview打開時,動畫縮放到位置/地圖地標iOS
更新的代碼:
- (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;
優秀感謝我將努力實現這一點有什麼方法我把第一組區域中,目前收到了未申報的錯誤:) – holtii
... – holtii
在viewDidLoad中,你已經擁有了它。只是改變跨度。 – Anna