So all I wanna do is play a sound when the user touches a UIScrollView. The UIScrollViewDelegate has that scrollViewWillBeginDragging: method but it only gets called on touchMoved. I want it to get called on touchBegan.
Tried touchesBegan:withEvent: but it doesn't receive any touch. Anyone has a clue?
You need to subclass scroll view and then implement the touchesBegan method.You need also set the delayTouchDown property to false.
Use a Tap Gesture Recognizer instead:
Or
make subClass of your
UIScrollView
and implement allNew updates on the issue here (including a link to ZoomScrollView source code + some excellent explanation on UIScrollView internals) . Also, check out Apple's updated ScrollViewSuite example.
Rajneesh071 answer in swift 4 Change the custom class of scrollView in storyboard to
CustomScrollView
You can also respond to these events in your controller. For that to work, you have to define this feature (in your controller):
Then, in 'viewDidAppear', you need to call 'becomeFirstResponder':
Use a Tap Gesture Recognizer instead: