Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Connecting cell to controller using a block
@interface MyTableViewCell
@property(nonatomic, copy) void (^checkboxHandler)(void);
@implementation MyTableViewCell
- (IBAction)checkboxPressed:(UIButton *)sender {
@implementation MyTableViewController
- (UITableViewCell *)tableView:(UITableView *)table cellForRowAtIndexPath:(NSIndexPath *)indexPath {
MyTableViewCell *cell = [table dequeueReusableCellWithIdentifier:@"cell"
cell.checkboxHandler = ^{
// Perform the desired work in response to checkbox
return cell;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.