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

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


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


I've had this problem with a UITableView which has custom UITableViewCells with UIButtons on it. I put this in my UITableview class.

- (BOOL)touchesShouldCancelInContentView:(UIView *)view {    return YES;}

Solved my problem.

EDIT: Just to clearify, you can create a subclass of UIScrollview and add this to solve the problem.


This hack works for me:

UITapGestureRecognizer *nothingTap = [[UITapGestureRecognizer alloc] init];nothingTap.delaysTouchesBegan = YES;[_scrollView addGestureRecognizer:nothingTap];

credit: https://devforums.apple.com/thread/241467


matomo