Skip to content

Instantly share code, notes, and snippets.

@nickjs
Created November 16, 2008 09:31
Show Gist options
  • Save nickjs/25441 to your computer and use it in GitHub Desktop.
Save nickjs/25441 to your computer and use it in GitHub Desktop.
@implementation LEPresentation : CPDictionary
- (void)setValue:(id)aValue forUndefinedKey:(CPString)keyPath
{
[self setObject:aValue forKey:keyPath];
}
- (void)mapToView:(CPView)aView
{
for(var i = 0; i < [[self allKeys] count]; i++)
{
var key = [self allKeys][i];
if([aView respondsToSelector:key])
{
[aView setValue:[self objectForKey:key] forKey:key];
[self addObserver:self forKeyPath:key options:CPKeyValueObservingOptionNew context:aView];
}
}
}
- (void)observeValueForKeyPath:(CPString)key ofObject:(id)object change:(CPDictionary)change context:(id)aView
{
if(aView)
if([aView respondsToSelector:key])
[aView setValue:[self objectForKey:key] forKey:key];
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment