[self.navigationController.navigationBar setBackgroundImage:imag forBarMetrics:UIBarMetricsDefault];
//button 定义你要的背景 文字 或 事件
UIBarButtonItem *leftBarButton = [[UIBarButtonItem alloc] initWithCustomView:button];
self.navigationItem.leftBarButtonItem = leftBarButton;
[leftBarButton release];
具体实现:
[self.navigationItem setTitle:@"通知详情"];
//self.navigationController.navigationBarHidden = NO;
[self.navigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@"root_top.png"] forBarMetrics:UIBarMetricsDefault];
self.navigationItem.hidesBackButton = YES;
UIButton *rightButton = [[UIButton alloc]initWithFrame:CGRectMake(SCREEN_WIDTH - 70, 10, 70, rootTopHeight - 20)];
[rightButton addTarget:self action:@selector(NoticeBackAction) forControlEvents:UIControlEventTouchUpInside];
[rightButton setBackgroundImage:[UIImage imageNamed:@"root_back.png"] forState:UIControlStateNormal];
[rightButton setTitle:@"退出" forState:UIControlStateNormal];
UIBarButtonItem *rightBarButton = [[UIBarButtonItem alloc]initWithCustomView:rightButton];
self.navigationItem.rightBarButtonItem = rightBarButton;