JT3DScrollView
JT3DScrollView copied to clipboard
Drag from outside the JT3DScrollView frame
The first thing I wanted to do with this View was drag on one of the images that was outside the View's frame. (The JT3DScrollView
has clipsToBounds
set to false, so the previous and next — and maybe others — show outside the View proper.)
The way to do this is to embed the JT3DScrollView
in another view. Make the enclosing view a custom subclass of UIView
and add this and only this method:
override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
if self.point(inside: point, with: nil) {
return subviews.first
} else {
return super.hitTest(point, with: event)
}
}
Now drags in the enclosing view will be passed to the enclosed JT3DScrollView
. Have fun! And thanks JT for such a clean implementation.