2 qq 24151965 qq_24151965 于 2015.07.16 14:50 提问

IOS 百度地图 标注删除不了?求求大神啊 拜托了

if (!_perList) {
_perList=[[PersonalViewController alloc]init];
[self becomeFirstResponder];
CGFloat y=CGRectGetMaxY(_toolBar.frame);
CGRect popFrame=CGRectMake(10, y, self.view.frame.size.width-20, self.view.frame.size.height-y-10);
_perList.view.frame=popFrame;
}
__unsafe_unretained PhLocationViewController*mapVC=self;
__unsafe_unretained PersonalViewController *per=_perList;
__block PhLocationViewController *blockSelf = self;
[_perList setSelectedBlock:^(NSString *name,NSString *uid)
{
[AlertHelper MBHUDShow:@"获取中" ForView:blockSelf.view AndDelayHid:30];
[per.view removeFromSuperview];
[phoneLocationWebAPI getUserInMapWithTpe:@"one" uid:uid stime:@"" etime:@"" success:^(NSArray *locList)
{
[mapVC->_mapView removeAnnotations:mapVC->_annoArr];

          if (locList.count==0)
          {
              [AlertHelper hideAllHUDsForView:blockSelf.view];
              [AlertHelper singleMBHUDShow:@"无定位数据" ForView:blockSelf.view AndDelayHid:1.5];
              return ;
          }
          Employee *em1=[[Employee alloc]initWithDic:locList[0]];
          CLLocationCoordinate2D dingweiZhongxin=CLLocationCoordinate2DMake([em1.latitude doubleValue], [em1.longitude doubleValue]);
            [mapVC showMap:CLLocationCoordinate2DMake(dingweiZhongxin.latitude, dingweiZhongxin.longitude) span:BMKCoordinateSpanMake(0.01, 0.01)];;
          for (NSDictionary *dict in locList)
          {
              Employee *em=[[Employee alloc]initWithDic:dict];
              CLGeocoder *geocoder=[[CLGeocoder alloc]init];
              CLLocationCoordinate2D loca2D=CLLocationCoordinate2DMake([em.latitude doubleValue], [em.longitude doubleValue]);

              CLLocation *la=[[CLLocation alloc]initWithLatitude:loca2D.latitude longitude:loca2D.longitude];
              [geocoder reverseGeocodeLocation: la completionHandler:^(NSArray *placemark,NSError *error)
               {
                   CLPlacemark *mark=[placemark objectAtIndex:0];
                   NSString *address = [NSString stringWithFormat:@"%@",mark.name];

                   BMKPointAnnotation *point=[[BMKPointAnnotation alloc]init];
                   point.coordinate=loca2D;
                   point.title=[NSString stringWithFormat:@"%@   状态:%@,%@",em.userName,([@"1" isEqualToString: em.zt  ])?@"在线":@"离线",em.time];
                   point.subtitle=address;
                   [mapVC->_annoArr addObject:point];
                   [mapVC->_mapView addAnnotations:mapVC->_annoArr];
               }];
          }
          [AlertHelper hideAllHUDsForView:blockSelf.view];
      } fail:^(){
          [AlertHelper hideAllHUDsForView:blockSelf.view];
          [AlertHelper singleMBHUDShow:@"网络请求失败" ForView:blockSelf.view AndDelayHid:1.5];
      }];

 }];
[self changeBtnSelected:sender popView:_perList.view];

为啥会出现旧的标注 这样写有什么问题啊

1个回答

CSDNXIAOD
CSDNXIAOD   2015.07.16 15:34

iOS 自定义百度地图标注气泡
iOS 之 使用百度地图 (删除地图页面所有自己添加的标注)
----------------------biu~biu~biu~~~在下问答机器人小D,这是我依靠自己的聪明才智给出的答案,如果不正确,你来咬我啊!

Csdn user default icon
上传中...
上传图片
插入图片