我想爲iOS 6實現自定義的UINavigationBar圖像背景,但我沒有運氣。它顯示的是蘋果公司的正常版本(沒有後退按鈕)。 我曾嘗試下面的代碼內viewDidLoad中(一個在時間):自定義UINavigationBar圖像
[[UINavigationBar appearance] setBackgroundImage:myImage forBarMetrics:UIBarMetricsDefault];
[self.navigationController.navigationBar setBackgroundImage:myImage forBarMetrics:UIBarMetricsDefault];
我通過呈現所需的視圖:
optionViewController *choose= [[optionViewController alloc] initWithNibName:@"optionViewController" bundle:nil];
UINavigationController *aNavController = [[UINavigationController alloc] initWithRootViewController:choose];
[self presentViewController: aNavController animated:YES completion:nil];
任何幫助,將不勝感激。謝謝!
發生什麼事? [self.navigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@「barImage.png」] forBarMetrics:UIBarStyleDefault];此命令在我的代碼中無處不在iOS5和iOS6中。 –
@LêQuýSang沒有任何反應......它只是顯示典型的基本UINaviationBar而不是我想要的圖像。謝謝 –