Created
November 17, 2014 15:48
-
-
Save oks/821e2ae4c452810e98e7 to your computer and use it in GitHub Desktop.
Correct handling buttons inside cells
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (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