使用此方法更改後退導航按鈕的標題和背景圖片。標題改變,但按鈕保持黑色更改後退按鈕背景圖片
- (void)viewDidLoad
{
[super viewDidLoad];
[self.navigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@"topBarbackground.png"] forBarMetrics:UIBarMetricsDefault];
UIBarButtonItem *backButton = [UIBarButtonItem new];
[backButton setBackgroundImage:[UIImage imageNamed:@"backButton.png"] forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
[backButton setTitle:NSLocalizedString(@"Back", nil)];
[[self navigationItem] setBackBarButtonItem:backButton];
}
這樣做的正確方法是什麼?
試試下面的代碼... – Jitendra
重複的問題:http://stackoverflow.com/問題/ 10496666/IOS -5-變化最背景的背鍵合導航控制器到透明傳輸 – Mrunal