Почему делает пользовательское изображение аннотации MKMapView, исчезают на касании?

Мой любимый является WinKey , U , Входят - завершает работу Windows!;-)

6
задан dc. 13 March 2014 в 01:48
поделиться

1 ответ

Отвечая на свой вопрос здесь, на случай, если у других возникнет такая же проблема. Обратите внимание, что я использую «MKPinAnnotationView» - его следует изменить на «MKAnnotationView», и все работает.

Фиксированный код:

- (MKAnnotationView *)mapView:(MKMapView *)newMapView viewForAnnotation:(id )newAnnotation {
    MKAnnotationView *annotation = [[MKAnnotationView alloc] initWithAnnotation:newAnnotation reuseIdentifier:@"currentloc"];

    if (annotation == nil) {
        annotation = [[MKAnnotationView alloc] initWithAnnotation:newAnnotation reuseIdentifier:@"currentloc"];
    }

    annotation.image = [UIImage imageNamed:@"anno.png"];
    annotation.canShowCallout = YES;
    annotation.rightCalloutAccessoryView = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
    UIImageView *imgView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"bus_stop_30x30.png"]];
    annotation.leftCalloutAccessoryView = imgView;

    return annotation;
}
17
ответ дан 8 December 2019 в 13:46
поделиться
Другие вопросы по тегам:

Похожие вопросы: