如何在百度地图上添加大头针

2025-02-28 07:17:45
推荐回答(2个)
回答1:

  •   创建mapview之后,设置delegate为当前vc,然后创建BMKPointAnnotation

  (一个BMKPointAnnotation就是一个地图上的点,如果有多个,用for 循环创建然后每一个都[self.mapView addAnnotation:annotation])

  •   然后在mapview的delegate方法里这样

  - (BMKAnnotationView *)mapView:(BMKMapView *)mapView viewForAnnotation:(id )annotation

  •   如果annotation为用户自身位置的小蓝点  就什么都不做


  系统  的

  GOEAnnotationView* newAnnotationView = [[GOEAnnotationView alloc]initWithAnnotation:annotation reuseIdentifier:@"myAnnotation"];


  return newAnnotationView;


  }


  return nil;


  }

回答2:

这样就可以实现了