Sha256: 82617492ccc03ae479d0ad8e0d228dba7965a6510db2bcaf7f8a0334fbbbf4f8
Contents?: true
Size: 916 Bytes
Versions: 2
Compression:
Stored size: 916 Bytes
Contents
// // MANotificationCenterAdditions.m // ZeroingWeakRef // // Created by Michael Ash on 7/12/10. // #import "MANotificationCenterAdditions.h" #import "MAZeroingWeakRef.h" @implementation NSNotificationCenter (MAZeroingWeakRefAdditions) - (id)addWeakObserver: (id)observer selector: (SEL)selector name: (NSString *)name object: (id)object { MAZeroingWeakRef *ref = [[MAZeroingWeakRef alloc] initWithTarget: observer]; id noteObj = [self addObserverForName: name object:object queue: nil usingBlock: ^(NSNotification *note) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; id observer = [ref target]; [observer performSelector: selector withObject: note]; [pool release]; }]; [ref setCleanupBlock: ^(id target) { [self removeObserver: noteObj]; [ref autorelease]; }]; return noteObj; } @end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
motion-memorymanagement-0.1.0 | MMRuntime/MMRuntime/MANotificationCenterAdditions.m |
motion-memorymanagement-0.0.1 | MMRuntime/MMRuntime/MANotificationCenterAdditions.m |