Ios 在MKMapView上重新排列自定义标记

Ios 在MKMapView上重新排列自定义标记,ios,mkmapview,mkannotation,Ios,Mkmapview,Mkannotation,我正在使用谷歌地图显示自定义标记。每次我点击搜索按钮,标记都会被洗牌。我已经完成了调试,还打印了NSLog。每一个条件都得到满足。我不知道有什么问题 代码如下: - (MKAnnotationView *) mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>) annotation { static NSString* identifier = @"abc"; MKAnnotationV

我正在使用谷歌地图显示自定义标记。每次我点击搜索按钮,标记都会被洗牌。我已经完成了调试,还打印了
NSLog
。每一个条件都得到满足。我不知道有什么问题

代码如下:

- (MKAnnotationView *) mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>) annotation
{
    static NSString* identifier = @"abc";

    MKAnnotationView* annView = [searchMapView dequeueReusableAnnotationViewWithIdentifier:identifier];

    Location *newLoc = [searchData objectAtIndex:count];

    if (annView == nil) 
    {    
        annView = [[[MKAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"cell"]autorelease];
        annView.rightCalloutAccessoryView = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];

        if(newLoc.isAvailable == YES)
        {    
            annView.image = [UIImage imageNamed:@"map_aicon.png"];
        }
        else
        {    
            annView.image = [UIImage imageNamed:@"map_bicon.png"];   
        }

        annView.tag = mapView.tag;
        annView.canShowCallout =YES;
    }

    count++;

    return annView;
}
-(MKAnnotationView*)地图视图:(MKMapView*)地图视图注释:(id)注释
{
静态NSString*标识符=@“abc”;
MKAnnotationView*annView=[searchMapView dequeueReusableAnnotationViewWithIdentifier:identifier];
Location*newLoc=[searchData对象索引:计数];
如果(annView==nil)
{    
annView=[[MKAnnotationView alloc]initWithAnnotation:annotation重用标识符:@“cell”]autorelease];
annView.rightCalloutAccessoryView=[UIButton Button类型为:UIButtonTypedTailDisclosure];
如果(newLoc.isAvailable==是)
{    
annView.image=[UIImage ImageName:@“map_aicon.png”];
}
其他的
{    
annView.image=[UIImage ImageName:@“map_bicon.png”];
}
annView.tag=mapView.tag;
annView.canShowCallout=是;
}
计数++;
返回视图;
}

欢迎使用Stackoverflow。您可以通过选择代码并单击
{}
按钮来格式化代码。您还可以缩进四个空格以获得一个缩进级别。这将提高你的问题的可读性和质量。你说的重新洗牌是什么意思?引脚/注释是否不规则地移动?“每次我点击搜索按钮,标记将被洗牌”请解释这部分。