Last active
August 29, 2015 14:20
-
-
Save fengb/fc1cf780923890426c83 to your computer and use it in GitHub Desktop.
KVO context hack
This file contains 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
#define CLASS_KVO_CONTEXT ((__bridge void *)[self class]) | |
[_quote addObserver:self forKeyPath:@"bid" options:0 context:CLASS_KVO_CONTEXT]; | |
#define CLASS_KVO_CONTEXT(instance) ((__bridge void *)[instance class]) | |
[_quote addObserver:self forKeyPath:@"bid" options:0 context:CLASS_KVO_CONTEXT(self)]; | |
#define KVO_CONTEXT(instance) ((__bridge void *)[instance class]) | |
[_quote addObserver:self forKeyPath:@"bid" options:0 context:KVO_CONTEXT([self class])]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment