Skip to content

Instantly share code, notes, and snippets.

@oks
Created November 17, 2014 15:48
Show Gist options
  • Save oks/821e2ae4c452810e98e7 to your computer and use it in GitHub Desktop.
Save oks/821e2ae4c452810e98e7 to your computer and use it in GitHub Desktop.
Correct handling buttons inside cells
- (instancetype)init
{
self = [super init];
if (self)
{
self.delaysContentTouches = NO;
}
return self;
}
- (BOOL)touchesShouldCancelInContentView:(UIView *)view
{
// Because we set delaysContentTouches = NO, we return YES for UIButtons
// so that scrolling works correctly when the scroll gesture
// starts in the UIButtons.
if ([view isKindOfClass:[UIButton class]])
{
return YES;
}
return [super touchesShouldCancelInContentView:view];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment