IOS CollectionViewCell嵌套Collecti

2018-04-16  本文已影响71人  MrLiangC

在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];
}

上一篇 下一篇

猜你喜欢

热点阅读