I have two view controllers. View controller A has a UIScrollView
and presents view controller B. The presentation is interactive and controlled by the sc
I have a scrollview inside of a superview to have left and right borders. To make those borders scrollable, this were my approach :
class CustomScrollView: UIScrollView {
override func hitTest(point: CGPoint, withEvent event: UIEvent?) -> UIView? {
if let view = super.hitTest(point, withEvent: event) {
return view
}
guard let superview = superview else {
return nil
}
return superview.hitTest(superview.convertPoint(point, fromView: self), withEvent: event)
}
override func pointInside(point: CGPoint, withEvent event: UIEvent?) -> Bool {
if super.pointInside(point, withEvent: event) {
return true
}
guard let superview = superview else {
return false
}
return superview.pointInside(superview.convertPoint(point, fromView: self), withEvent: event)
}
}
Works perfectly