Just another update

This commit is contained in:
Ingy döt Net 2015-02-20 00:35:01 -05:00
parent a25938f123
commit 00a190b0a6
6591 changed files with 94363 additions and 23227 deletions

View file

@ -1,7 +1,7 @@
#import <Foundation/Foundation.h>
#import <objc/runtime.h>
static char fooKey;
static void *fooKey = &fooKey; // one way to define a unique key is a pointer variable that points to itself
int main (int argc, const char *argv[]) {
@autoreleasepool {
@ -9,10 +9,10 @@ int main (int argc, const char *argv[]) {
id e = [[NSObject alloc] init];
// set
objc_setAssociatedObject(e, &fooKey, @1, OBJC_ASSOCIATION_RETAIN);
objc_setAssociatedObject(e, fooKey, @1, OBJC_ASSOCIATION_RETAIN);
// get
NSNumber *associatedObject = objc_getAssociatedObject(e, &fooKey);
NSNumber *associatedObject = objc_getAssociatedObject(e, fooKey);
NSLog(@"associatedObject: %@", associatedObject);
}