Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ios 8 - buttons in horizontal scroll view intercepting pan event - scroll does not work

I have a horizontal scroll view with a line of buttons. The scroll view will not scroll unless I do an extremely fast swipe.

If I set the buttons to userInteractionEnabled = NO, then the scrolling works as expected, but of course, then the buttons don't work at all.

This app worked fine in iOS 7 and before. It seems to be a iOS 8 "feature". I did notice that I can catch the button's drag event, but I don't know how to redirect it back to the scrollView.

I'm thinking I'll need to replace my buttons with UIViews and manage the events myself but I'd be grateful if someone has other ideas or solutions.

like image 808
Mike M Avatar asked Sep 12 '14 03:09

Mike M


1 Answers

I found that in iOS 8, the UIScrollView's underlying UIPanGestureRecognizer is not respecting the UIScrollView's delaysContentTouches property. I consider this an iOS 8 bug. Here's my workaround:

theScrollView.panGestureRecognizer.delaysTouchesBegan = theScrollView.delaysContentTouches 
like image 77
lifjoy Avatar answered Oct 06 '22 01:10

lifjoy