//点击大头针触发事件
-(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];
}
}