地图上设置MKAnnotationView 的image属性无法正常显示
问题代码如下:
MKPinAnnotationView *annotationView = [[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:locationReuseIndetifier];
annotationView.canShowCallout = NO;
annotationView.draggable = NO;
annotationView.image = [UIImage imageNamed:@"img_custom"];
return annotationView ;
修改成:
MKAnnotationView *annotationView = [[MKAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:ReuseIndetifier];
annotationView.canShowCallout = NO;
annotationView.draggable = NO;
annotationView.image = [UIImage imageNamed:@"img_custom"];
return annotationView ;
便可以正常显示。
MKPinAnnotationView :不能改变大头针的图片 可以改变颜色
MKAnnotationView:自己随意定义大头针的样式