UIScrollView 嵌套UITableView 左滑删除和

2022-05-21  本文已影响0人  花漾爱意

UISlider UIControl 和系统右滑手势冲突方案解决

extension UISlider {
    open override func gestureRecognizerShouldBegin(_ gestureRecognizer: UIGestureRecognizer) -> Bool {
        false
    }
}


extension UIControl {
    open override func gestureRecognizerShouldBegin(_ gestureRecognizer: UIGestureRecognizer) -> Bool {
        false
    }
}

UIScrollView 嵌套UITableView 左滑删除和UIScrollView滑动冲突

// 创建UISCrollView 子类
class CommonScrollerView: UIScrollView {
    
    override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
        let view = super.hitTest(point, with: event)
        if view?.superview?.superview is VehicleLogTableViewCell {
            self.isScrollEnabled = false
        } else {
            self.isScrollEnabled = true
        }
        return view
    }
}
上一篇下一篇

猜你喜欢

热点阅读