amap5R1hYkeZ 发表于 2015-11-24 20:13:33

高德地图多点标注问题

做一个儿童防丢客户端。需要在地图上用不同的图标标注儿童和用户当前的位置。
实现通过高德定位获取手机用户的位置经纬度,服务器获取儿童手表获取的经纬度。
地图界面有两个按钮,显示“定位”+“儿童位置”。
使用:
AMapReGeocodeSearchRequest *regeo = [ init];
   
    regeo.location = ;
    regeo.requireExtension = YES;
   
    ;

方法在地图上分别标注“定位”+“儿童位置”,通过以下方法修改定位图标:
- (MAAnnotationView *)mapView:(MAMapView *)mapView viewForAnnotation:(id<MAAnnotation>)annotation
{
    if (])
    {
static NSString *reuseIndetifier = @"annotationReuseIndetifier";
            _annotationChildView = (MAAnnotationView *);
            if (_annotationChildView == nil)
            {
                _annotationChildView = [ initWithAnnotation:annotation
                                                                  reuseIdentifier:reuseIndetifier];
            }

            _annotationChildView.image = ;
            //设置中⼼心点偏移,使得标注底部中间点成为经纬度对应点
            _annotationChildView.centerOffset = CGPointMake(0, 0);

            return _annotationChildView;

}
}

发现实现出来的效果,用户定位图标不稳定,总是相互跳动,无法同时标注“用户位置”+“儿童位置”,点击切换总是莫名其妙的出问题。



有没有更好地方法,实现不同图标在地图上标注位置。点击还可以相关切换定位的位置,而不会莫名其妙的出现图标跳动。


hades_h 发表于 2016-2-23 13:38:39

不同的图标,你需要创建不同的annotation类区分。
自定义定位图标也不是这样的吧,你这样只是添加了个ReGeocodeAnnotation。可以参考我们的官方Demo里的实现。
页: [1]
查看完整版本: 高德地图多点标注问题