iPhone的自定义导航栏
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了iPhone的自定义导航栏相关的知识,希望对你有一定的参考价值。
RGBCOLOR() is defined at Three20.
@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
以上是关于iPhone的自定义导航栏的主要内容,如果未能解决你的问题,请参考以下文章