【问题标题】:Current location annotation default look?当前位置注释默认外观?
【发布时间】:2012-10-21 16:52:00
【问题描述】:

我有以下代码:

- (MKAnnotationView *) mapView:(MKMapView *) mapView viewForAnnotation:(id ) annotation {

    MKPinAnnotationView *customAnnotationView=[[[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:nil] autorelease];

    customAnnotationView.pinColor = MKPinAnnotationColorRed;
    customAnnotationView.animatesDrop = NO;
    customAnnotationView.canShowCallout = YES;

    UIButton *rightButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
    [rightButton addTarget:self action:@selector(annotationViewClick:) forControlEvents:UIControlEventTouchUpInside];

    customAnnotationView.rightCalloutAccessoryView = rightButton;

    return customAnnotationView;
}

这个方法改变了mapview上的每一个注解,包括当前位置的蓝圈注解。我只想更改我的自定义注释,不理会当前位置注释。

我该怎么做?

【问题讨论】:

    标签: ios mapkit mkannotation mkannotationview


    【解决方案1】:

    如果注解是userLocation注解,则返回nil

    if(annotation == mapView.userLocation){
        return nil;
    }
    

    【讨论】:

      猜你喜欢
      • 2012-05-20
      • 1970-01-01
      • 1970-01-01
      • 2011-08-10
      • 1970-01-01
      • 1970-01-01
      • 2016-09-02
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多