其他分享
首页 > 其他分享> > Swift UITableView嵌套UICollectionView点击事件冲突(点击事件穿透)

Swift UITableView嵌套UICollectionView点击事件冲突(点击事件穿透)

作者:互联网

 

 

 

不管是啥都响应tableviewcell

class JYShopCertificationCell: UITableViewCell {    

        override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
        return self
        }

}

 

2.只穿透UICollectionView

    override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
        let view = super.hitTest(point, with: event)
        if let bool = (view?.isKind(of: UICollectionView.self)) {
            if bool {
                return self
            }
        }
        return view
    }

 

 

https://www.jianshu.com/p/4424ebd567d6

标签:return,point,UICollectionView,self,hitTest,点击,UITableView,event
来源: https://www.cnblogs.com/qingzZ/p/10694451.html