Created
November 26, 2014 09:12
-
-
Save mikeabdullah/3fa357b3f1a5151804bd to your computer and use it in GitHub Desktop.
Connecting cell to controller by delegation
This file contains 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
@protocol MyTableViewCellDelegate | |
- (void)tableCellCheckboxPressed:(MyTableViewCell *)cell; | |
@end |
This file contains 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
@implementation MyTableViewCell | |
- (IBAction)checkboxPressed:(UIButton *)checkbox { | |
[self.delegate tableCellCheckboxPressed:self]; | |
} | |
@end |
This file contains 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
@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