Skip to content

Instantly share code, notes, and snippets.

@pier-oliviert
Created December 21, 2010 21:57
Show Gist options
  • Save pier-oliviert/750689 to your computer and use it in GitHub Desktop.
Save pier-oliviert/750689 to your computer and use it in GitHub Desktop.
@implementation RootView
- (void)drawRect:(CGRect)rect {
self.highlighted ? [[UIColor whiteColor] set] : [[UIColor blackColor] set];
[self.text drawAtPoint:CGPointMake(5, 10) withFont:[UIFont systemFontOfSize:15.0]];
}
- (void)setText:(NSString *)t {
[m_text release];
m_text = nil;
m_text = [t retain];
[self setNeedsDisplay];
}
- (void)setHighlighted:(BOOL)h {
m_highlighted = h;
[self setNeedsDisplay];
}
- (void)sizeToFit {
self.frame = CGRectMake(0, 0, 0, 44);
}
@synthesize text = m_text;
@synthesize highlighted = m_highlighted;
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment