小编Rak*_*mar的帖子

如何在MKMapView中的MKAnnotation上设置图像

我正在开发一个用于聊天的应用程序,我必须在地图上显示所有朋友的图像.请提供实施指南.

我用过以下代码......

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

MKPinAnnotationView *annView = [[MKPinAnnotationView alloc]init]; 
UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Done.png"]];

annView.animatesDrop = TRUE;
annView.canShowCallout = YES;
annView.calloutOffset = CGPointMake(-5, 5);
[annView addSubview:imageView];
return annView;
 }
Run Code Online (Sandbox Code Playgroud)

谢谢

iphone ios

2
推荐指数
2
解决办法
9803
查看次数

标签 统计

ios ×1

iphone ×1