IOS开发 百度地图添加Annotation,并修改图标。

来源:互联网 发布:java eclipse下载64位 编辑:程序博客网 时间:2024/06/03 14:10
<span style="white-space:pre"></span>不想在百度地图上以大头针的形式打标记,需改变大头针的图标。用一个按钮触发事件代码:<pre name="code" class="objc">- (IBAction)imageTestButton:(id)sender {    BMKPointAnnotation *pointAnnotation = [[BMKPointAnnotation alloc]init];    if (_locationInfo != nil) {//在地图上标记大头针        pointAnnotation.coordinate = _locationInfo.location.coordinate;        [_mapView addAnnotation:pointAnnotation];    }    //改变大头针图标    BMKAnnotationView * annotationView = [_mapView viewForAnnotation:pointAnnotation];    annotationView.image = [UIImage imageNamed:@"big.png"];}

                                             
0 0