在我的地图视图中,我将地图设置为打开,然后延迟 2 秒,地图会放大以显示我的 mkannotation,我一直在尝试做的是在视图完全放大后动画针落下,但没有无法做到这一点。
所以基本上我想在我的位置放置注释+引脚添加延迟。
我该怎么做呢?
编写我当前在 ViewDidLoad 中的代码,mkannotation 的代码是无效的 - showDetails:
- (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 2 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];
DisplayMap *ann = [[DisplayMap alloc] init];
ann.title = @"Design Museum";
ann.subtitle = @"Camberwell, London";
ann.coordinate = region.center;
[mapView addAnnotation:ann];
}