Ios6 如何将延迟添加到引脚放置

Ios6 如何将延迟添加到引脚放置,ios6,mkmapview,mkannotation,Ios6,Mkmapview,Mkannotation,在我的地图视图中,我将地图设置为打开,然后延迟2秒,地图将放大以显示我的mkannotation,我一直尝试的是在视图完全放大后设置插针掉落的动画,但未能实现这一点 因此,基本上,我想给放置在我的位置的annotation+pin添加一个延迟 我该怎么做 编码我当前在ViewDidLoad中的代码,mkannotation的代码无效-showDetails: - (void)viewDidLoad { [super viewDidLoad]; // Do any additional s

在我的地图视图中,我将地图设置为打开,然后延迟2秒,地图将放大以显示我的mkannotation,我一直尝试的是在视图完全放大后设置插针掉落的动画,但未能实现这一点

因此,基本上,我想给放置在我的位置的annotation+pin添加一个延迟

我该怎么做

编码我当前在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];
}
如果在设置区域之前设置了代理,则您的代理将收到对其的呼叫。滚动时会多次调用,因此您可以检查地图的当前中心点,当它足够接近目标中心点时,添加注释

- (void)viewDidLoad
{
    [super viewDidLoad];
    [mapView setDelegate:self];
     ............
    haveAddedPin = false;
}


-(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];
}

-(void)mapView:(MKMapView *)mapView regionDidChangeAnimated:(Boolean) animated)
{
    if (haveAddedPin == false && mapView.center == the coordinates of the target you are zooming to)
    {
        DisplayMap *ann = [[DisplayMap alloc] init];
        ann.title = @"Design Museum";
        ann.subtitle = @"Camberwell, London";
        ann.coordinate = region.center;
        [mapView addAnnotation:ann];
        haveAddedPin = true;
    }
}

你在哪一点上遇到了问题?我的mapview延迟工作,然后它按我所希望的方式放大,问题是我想延迟掉针,我尝试用它自己的方法,但没有起作用。你试过我的建议吗?或者,如果您不想这样做,请尝试您正在使用的
性能选择器:withObject:afterDelay
函数。我不明白您的意思,您可以发布示例代码吗?还有其他帮助吗?我应该用什么来代替“haveaddepin”?这是未申报的