美文网首页
34.百度地图开发总结

34.百度地图开发总结

作者: bytebytebyte | 来源:发表于2020-11-23 00:03 被阅读0次
    1.大头针可以点击必须实现BMKPointAnnotation的title方法
    //点击大头针触发事件
    -(void)mapView:(BMKMapView *)mapView didSelectAnnotationView:(BMKAnnotationView *)view
    
    2.BMKAnnotationView有tag值可以获取到点击的那个大头针
    
    例如:
    
    -(void)mapView:(BMKMapView *)mapView
    didSelectAnnotationView:(BMKAnnotationView *)view
    {
        if ([view isKindOfClass:[CustomBMKAnnotationView class]]) {
            if (((CustomBMKAnnotationView *)view).type >= 0) {
                self.model = self.dangerArray[((CustomBMKAnnotationView *)view).type];
                WS(weakSelf);
                [UIView animateWithDuration:0.3 animations:^{
                    weakSelf.av.bottomView.frame = CGRectMake(0, kScreenHeight - 90, kScreenWidth, 90);
                    weakSelf.av.locationButton.frame = CGRectMake(CGRectGetWidth(weakSelf.av.mapView.frame) - 45, CGRectGetHeight(weakSelf.av.mapView.frame) - 45 - 90, 30, 30);
                }];
            }
        }
        else if([view isKindOfClass:[CircleAnnotationView class]])
        {
            //点击大头针变色,滚动到相应行数
            NSIndexPath *indexPath = [NSIndexPath indexPathForRow:((CircleAnnotationView *)view).type inSection:0];
            [self.av.hotTableView scrollToRowAtIndexPath:indexPath atScrollPosition:(UITableViewScrollPositionTop) animated:YES];
        }
        else if ([view isKindOfClass:[BMKAnnotationView class]])
        {
            NSIndexPath *indexPath = [NSIndexPath indexPathForRow:view.tag inSection:0];
            [self.av.hotTableView scrollToRowAtIndexPath:indexPath atScrollPosition:(UITableViewScrollPositionTop) animated:YES];
    
        }
    }
    
    

    相关文章

      网友评论

          本文标题:34.百度地图开发总结

          本文链接:https://www.haomeiwen.com/subject/cozfmktx.html