Return to Snippet

Revision: 31745
at September 11, 2010 14:45 by zuzara


Initial Code
@implementation UINavigationBar (CustomImage)
- (void)drawRect:(CGRect)rect
{
    NSLog(@"self.topItem.title = %@", self.topItem.title);
    CGRect frame = CGRectMake(0, 0, self.frame.size.width, self.frame.size.height);
    UIImage *image = [UIImage imageNamed: @"background.png"];
    [image drawInRect:frame];
    UILabel *label = [[[UILabel alloc] initWithFrame:frame] autorelease];
    [label setBackgroundColor:[UIColor clearColor]];
    label.font = [UIFont boldSystemFontOfSize: 20.0];
    //label.shadowColor = [UIColor colorWithWhite:1.0 alpha:1];
    label.textAlignment = UITextAlignmentCenter;
    label.textColor = RGBCOLOR(73, 81, 85);
    label.text = self.topItem.title;
    self.topItem.titleView = label;
    self.tintColor = RGBCOLOR(229, 239, 246);
}
@end

Initial URL


Initial Description
RGBCOLOR() is defined at Three20.

Initial Title
Custom Navigation Bar for iPhone

Initial Tags
iphone

Initial Language
Objective C