Created
November 26, 2014 08:59
-
-
Save mikeabdullah/376df5ea7dffb110ea25 to your computer and use it in GitHub Desktop.
Connecting in-cell button direct to view controller
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 | |
- (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