Skip to content

Instantly share code, notes, and snippets.

@Synvox
Created June 8, 2011 13:38
Show Gist options
  • Save Synvox/1014433 to your computer and use it in GitHub Desktop.
Save Synvox/1014433 to your computer and use it in GitHub Desktop.
@implementation FileLabel : CPView
{
CPTextField text;
}
- (id) init
{
self = [super initWithFrame:CGRectMakeZero()];
text = [[CPTextField alloc] initWithFrame:[self bounds]];
[self addSubview:text];
return self;
}
- (void)setSelected:(BOOL)isSelected
{
[self setBackgroundColor:isSelected ? [CPColor blueColor] : nil];
}
- (void)setRepresentedObject:(id)aString
{
self = [super initWithFrame:CGRectMakeZero()];
text = [[CPTextField alloc] initWithFrame:[self bounds]];
[self addSubview:text];
[text setStringValue:aString];
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment