Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Connecting cell to controller by delegation
@protocol MyTableViewCellDelegate
- (void)tableCellCheckboxPressed:(MyTableViewCell *)cell;
@end
@implementation MyTableViewCell
- (IBAction)checkboxPressed:(UIButton *)checkbox {
[self.delegate tableCellCheckboxPressed:self];
}
@end
@implementation MyTableViewController
- (void)tableCellCheckboxPressed:(MyTableViewCell *)cell {
NSIndexPath *row = [self.tableView indexPathForCell:cell];
// Look up task and work with it
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment