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
As an addition to solution of @johnboiles. When you catch the entire rect, then touches on elements inside the scrollview will be skipped. You could add aditional touch areas and for the normal scrollview just pass it on to the super.hitTest like this:
class MagicScrollView: UIScrollView {
override func hitTest(point: CGPoint, withEvent event: UIEvent?) -> UIView? {
if CGRectContainsPoint(CGRect(x: self.bounds.origin.x - 30, y: self.bounds.origin.y, width: 30, height: self.bounds.size.height), point) {
return self
}
if CGRectContainsPoint(CGRect(x: self.bounds.origin.x + self.bounds.size.width, y: self.bounds.origin.y, width: 30, height: self.bounds.size.height), point) {
return self
}
return super.hitTest(point, withEvent: event)
}
}