将图像和标题添加到基于选项卡的应用程序的导航栏

时间:2011-04-07 08:32:22

标签: iphone ipad

我想将图像和背景图像添加到基于选项卡的应用程序的导航栏

2 个答案:

答案 0 :(得分:2)

 self.navigationItem.titleView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"navbarimg.png"]];

答案 1 :(得分:-1)

@implementation UINavigationBar (CustomImage)
- (void)drawRect:(CGRect)rect
{
  UIImage *image = [UIImage imageNamed: @"your_image_name"];
  [image drawInRect:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
}
@end

要设置标题,您可以尝试

self.title = @"your title";