直接上代码
class CustomScrollview: UIScrollView {
override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
switch event?.type {
case .touches:
print("touch")
default:
return super.hitTest(point, with: event)
}
guard let v = super.hitTest(point, with: event) else {
return nil
}
if v.isKind(of: UIScrollView.self) {
return v
}
if (contentOffset.y + bounds.height) >= contentSize.height {
return nil
}
return v
}
}