小编jef*_*eff的帖子

iOS中的自定义注释图像

我试图用特定的图像替换典型的iOS mapkit"pin".我是编码的新手,所以我不确定为什么这不起作用,但这是我尝试过的:

对于该方法

- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation
{
Run Code Online (Sandbox Code Playgroud)

除此之外,我还有:

pinView.animatesDrop=YES;
pinView.canShowCallout=YES;
//pinView.pinColor=MKPinAnnotationColorPurple;
UIImage *pinImage = [UIImage imageNamed:@"Jeff.png"];
[pinView setImage:pinImage];
Run Code Online (Sandbox Code Playgroud)

但是,即使代码编译得很好,pinView也没有设置pinImage.任何想法为什么不呢?

annotations objective-c mapkit ios

6
推荐指数
1
解决办法
2万
查看次数

标签 统计

annotations ×1

ios ×1

mapkit ×1

objective-c ×1