react native调用baidu地图,设置气泡显示后,气泡不消失



  • manager.m文件中调用

    (UIView *)view
    {
    bm=[DistributeMap new];
    bm.bridge=self.bridge;
    return bm;
    }
    在DistributeMap中创建地图

    (instancetype)initWithFrame:(CGRect)frame
    {
    self = [super initWithFrame:frame];
    if (self) {
    _mapView = [[BMKMapView alloc]initWithFrame:CGRectMake(0, 0, [[UIScreen mainScreen] bounds].size.width, [[UIScreen mainScreen] bounds].size.height)];

    _mapView.delegate = self;
    [_mapView setCenterCoordinate:[self getcoordinate:@"106.531186,29.625107" with:@","]];
    [_mapView setZoomLevel:10];

    [self addSubview:_mapView];

    }
    return self;
    }

    用DisAnnotationView的setSelected:YES显示气泡信息,当再次调用第二个DisAnnotationView的setSelected:YES时第一个气泡不消失...

    百度地图文档中的解释是
    ///默认为NO,当view被点中时被设为YES,用户不要直接设置这个属性.若设置,需要在设置后调用BMKMapView的- (void)mapForceRefresh; 方法刷新地图
    @property (nonatomic, getter=isSelected) BOOL selected;

    我也调用了mapForceRefresh方法,但气泡还是不消失,
    求各位大神帮忙...



  • 解决了...
    原来是调错方法了,应该用- (void)selectAnnotation:(id <BMKAnnotation>)annotation animated:(BOOL)animated;


登录后回复