Пользовательский маркер перетасовывается в MKMapView - PullRequest
0 голосов
/ 19 мая 2011

Я использую Google Maps для отображения пользовательского маркера. Каждый раз, когда я нажимаю на кнопку поиска, маркер должен быть перемешан. Я уже сделал отладку, а также напечатал 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;
}
...