Skip to content

Instantly share code, notes, and snippets.

@mako34
Created April 29, 2014 07:39
Show Gist options
  • Select an option

  • Save mako34/11393112 to your computer and use it in GitHub Desktop.

Select an option

Save mako34/11393112 to your computer and use it in GitHub Desktop.
//MyCell.h
@protocol MyCellDelegate <NSObject>
-(void)cellCheckBoxWasChanged:(MyCell *)cell;
@end
@interface MyCell : NSObject
@property (nonatomic, weak) id <MyCellDelegate> delegate;
@end
***
//MyCell.m
@implementation MyCell
- (void)checkBoxChanged
{
[self.delegate cellCheckBoxWasChanged:self];
}
@end
***-*-*---
//TableViewController.m
- (void)cellCheckBoxWasChanged:(MyCell *)cell
{
NSIndexPath *indexPath = [self.tableView indexPathForCell:cell];
// do something to your array.
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment