Posted By

zuzara on 09/11/10


Tagged

iphone


Versions (?)

Who likes this?

7 people have marked this snippet as a favorite

umang_nine
bobbym245
sb
nsbuckner
synced
wpellis
cnathan


Custom Navigation Bar for iPhone


 / Published in: Objective C
 

RGBCOLOR() is defined at Three20.

  1. @implementation UINavigationBar (CustomImage)
  2. - (void)drawRect:(CGRect)rect
  3. {
  4. NSLog(@"self.topItem.title = %@", self.topItem.title);
  5. CGRect frame = CGRectMake(0, 0, self.frame.size.width, self.frame.size.height);
  6. UIImage *image = [UIImage imageNamed: @"background.png"];
  7. [image drawInRect:frame];
  8. UILabel *label = [[[UILabel alloc] initWithFrame:frame] autorelease];
  9. [label setBackgroundColor:[UIColor clearColor]];
  10. label.font = [UIFont boldSystemFontOfSize: 20.0];
  11. //label.shadowColor = [UIColor colorWithWhite:1.0 alpha:1];
  12. label.textAlignment = UITextAlignmentCenter;
  13. label.textColor = RGBCOLOR(73, 81, 85);
  14. label.text = self.topItem.title;
  15. self.topItem.titleView = label;
  16. self.tintColor = RGBCOLOR(229, 239, 246);
  17. }
  18. @end

Report this snippet  

You need to login to post a comment.