Last active
December 28, 2015 15:39
-
-
Save mako34/7522932 to your computer and use it in GitHub Desktop.
iOS, objC : delegate reminder
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
| ///// | |
| # MyMuch.h | |
| @protocol MyMuchDelegate; | |
| @interface MyMuch : MyMuchViewController | |
| { | |
| //id<MyMuchDelegate> _delegate; //new style not needed | |
| } | |
| @property (nonatomic, retain)id<MyMuchDelegate> delegate; | |
| @end | |
| @protocol MyMuchDelegate <NSObject> | |
| @optional | |
| //make this one pass a dicto! | |
| - (void)cellSelected:(NSDictionary*)dictoData; | |
| @end | |
| //// | |
| # MyMuch.m | |
| //question, ?. not necesary? check? | |
| if (self.delegate && [self.delegate respondsToSelector:@selector(cellSelected:)]) | |
| { | |
| NSDictionary *dataDicto = @{@"modeKey" : self.mode, @"indexKey" : [NSNumber numberWithInt:indexPath.row]}; | |
| [self.delegate performSelector:@selector(cellSelected:) withObject:dataDicto]; | |
| } | |
| /// implementa delegato | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment