在CollectionViewCell上嵌套CollectionView,点击cell时无效,利用响应链来解决,
重写此方法,当点击Cell时系统会遍历当前视图上的子视图
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event {
//点击获取在哪个视图上
UIView *view = [super hitTest:point withEvent:event];
if ([view isKindOfClass:[UICollectionView class]] || [view isKindOfClass:[BarView class]]) {
return self;
}
return [super hitTest:point withEvent:event];
}
网友评论