我为我的注释设置了自定义pinImage,当我将类型更改为MKMapTypeHybrid它时,将pinImage设置恢复为标准引脚.
我viewWillAppear在地图视图控制器的方法中设置了mapType .我正在为这样的注释设置我的pinImage(为了清晰起见缩短了):
- (MKAnnotationView *) mapView:(MKMapView *) mapView viewForAnnotation:(id ) annotation {
MKPinAnnotationView *customAnnotationView=[[[MKPinAnnotationView alloc]
initWithAnnotation:annotation
reuseIdentifier:@"markerAnnotationView"] autorelease];
UIImage *pinImage = [UIImage imageNamed:@"/pin-image"];
[customAnnotationView setImage:pinImage];
return customAnnotationView;
}
Run Code Online (Sandbox Code Playgroud)
有没有办法setImage通过代码使用和设置mapType?