Question

I have a series of UIViews inside a UIScrollView, and the UIViewControllers for those views are not receiving the touch events. If I take the views out of the scroll view then it works.

I have enabled userInteraction on the views but it's still not working!

This must be possible and I'd be really grateful if someone could point me in the right direction!

Thanks,

Mike

Was it helpful?

Solution 2

I have overcome this issue by overriding the loadView method of the view controller, and setting the view's instance variable to a simple UIView subclass which passes on the touches.

OTHER TIPS

Do the views have their own touch handlers, or are you relying on the viewcontroller to get the touches? Depending on how you have set things up, the views may be handling the touches without passing through to the view controller.

Check what you are returning in scrollview delegate method view for scrollin in scroll view.

As mahboudz mentioned - check if you have any custom handler for touch event. If not, please have one. Its far more relief to do whatever you want to do with your view. Check out Apples sample app from scrollViewSuite. They have tapDetectingImageView delegate. I used the same in my app it worked great! Hope this helps!

You may find this post useful. It's an example of a pretty clean way of intercepting events.

Have touch handlers for view for which you want to receive touch events and that will work.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top