Skip to content

Instantly share code, notes, and snippets.

@falkorichter
Created May 3, 2012 16:02
Show Gist options
  • Save falkorichter/2586799 to your computer and use it in GitHub Desktop.
Save falkorichter/2586799 to your computer and use it in GitHub Desktop.
Anonymous Notification sythesization and setter
#define CUSTOM_NSNOTIFICATION_SETTER(setterMethodName,ivarName,_ivarName)\
\
@synthesize ivarName = _ivarName; \
\
- (void)setterMethodName:(id)ivarName{ \
if (_ivarName != ivarName) { \
if (_ivarName != nil) { \
[[NSNotificationCenter defaultCenter] removeObserver:_ivarName]; \
} \
_ivarName = ivarName; \
} \
} \
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment