自定义标记在MKMapView上重新调整

时间:2011-05-19 07:01:31

标签: ios mkmapview mkannotation

我正在使用Google地图显示自定义标记。每次我点击搜索按钮时,标记都必须进行洗牌。我已经完成了调试并打印了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;
}

0 个答案:

没有答案