Custom Navigation Bar for iPhone


/ Published in: Objective C
Save to your folder(s)

RGBCOLOR() is defined at Three20.


Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.