Created
April 29, 2014 07:39
-
-
Save mako34/11393112 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| //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