Skip to content

Instantly share code, notes, and snippets.

@mikeabdullah
Created November 26, 2014 08:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikeabdullah/376df5ea7dffb110ea25 to your computer and use it in GitHub Desktop.
Save mikeabdullah/376df5ea7dffb110ea25 to your computer and use it in GitHub Desktop.
Connecting in-cell button direct to view controller
@implementation MyTableViewController
- (IBAction)checkboxPressed:(UIButton *)button {
// Figure out which row this checkbox belongs to
id aView = button.superview;
while (![aView isKindOfClass:UITableViewCell.class]) {
aView = [aView superview];
}
NSIndexPath *row = [self.tableView indexPathForCell:aView];
// Now can look up the task at that row and work with it
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment