/ Published in: Objective C
This is a wrapper for objects that use Key-Value Coding (KVC) in Objective-C. An appropriate use would be for business objects whose state changes throughout the life of the application session.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
// // KVCEnabledObject.h // #import <Foundation/Foundation.h> NSMutableDictionary *_metadata; } @end @implementation KVCEnabledObject - (id)init { if (self = [super init]) { } } { if (nil != value) { [_metadata setValue:value forKey:key]; } } { } { id ret = [_metadata valueForKey:key]; } - (void)dealloc { [_metadata removeAllObjects]; [_metadata release]; [super dealloc]; } @end