Skip to content

Instantly share code, notes, and snippets.

@mako34
Last active December 28, 2015 15:39
Show Gist options
  • Select an option

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

Select an option

Save mako34/7522932 to your computer and use it in GitHub Desktop.
iOS, objC : delegate reminder
/////
# 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