zoukankan      html  css  js  c++  java
  • 实现 iOS UICollectionView的事件透传

    比如当前的collectionViewA(蓝色), 还有一个collectionViewCellA(红色),collectionViewCellA(红色)里面有一个collectionViewB(绿色),

    collectionViewCellB(绿色)里面有两个collectionViewCellB1(白色)、collectionViewCellB2(白色)

    点击collectionViewCellA(红色) 弹出点击collectViewAcell

    点击collectionViewB(绿色) 也弹出点击collectViewAcell 

    点击collectionViewCellB1(白色)、collectionViewCellB2(白色) 弹出点击collectViewBcell

    - (UIView*)hitTest:(CGPoint)point withEvent:(UIEvent *)event {
        CGPoint btnPointInA = [self.collectView convertPoint:point fromView:self];
        if ([self.collectView pointInside:btnPointInA withEvent:event]) {
            for (UIView *subView in self.collectView.subviews) {
                CGPoint subViewPoint = [subView convertPoint:point fromView:self];
                if ([subView pointInside:subViewPoint withEvent:event]) {
                    return subView;
                }
            return self;
        }
        // 否则,返回默认处理
        return [super hitTest:point withEvent:event];
    }
  • 相关阅读:
    读取assets下的文件
    ViewPager的图片轮播
    ImageLoader的用法
    qpp的客户端
    服务器
    webview的使用
    AsyncTask方法
    HttpClientDopost方法
    通过 httpclientget 方法 向服务器中请求数据
    viewpager滑动button按钮选项卡跟着变动颜色
  • 原文地址:https://www.cnblogs.com/xilanglang/p/11474102.html
Copyright © 2011-2022 走看看