百度地图开发总结

来源:互联网 发布:7u分享网络怎么提现 编辑:程序博客网 时间:2024/06/04 23:26
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];

    }
}

0 0