我已將圖像添加到我的項目中。奇怪的是,在文件系統上它位於應用程序的根目錄中,而在XCode中的項目瀏覽器中,我已將它放在/Images/navbar-bg.png
中。如何使這一致?無法將背景圖像設置爲UINavigationController
順便說一句,我想o添加它作爲背景圖像到我的UINavigationController。這是代碼,但我沒有看到從默認的藍色背景的變化:
// navigation
navigationController = [[UINavigationController alloc] initWithRootViewController:cardListViewController];
// ps hue: 37, 53, -5
navigationController.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"navbar-bg" ofType:@"png"]]];
self.window.rootViewController = navigationController;
我也試過UIImage imageNamed
沒有結果。我想通過編程來完成,而且我在這裏沒有使用任何xib。
感謝