1
我有我想創建一個自定義uinavigationn吧我想這碼iphone:在導航欄設置背景圖片是不恰當
UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0.0, 0.0, self.view.bounds.size.width, self.view.bounds.size.height)];
//here for v, width= navBar width and height=navBar height
//
[view setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"newsBanner.png"]]];
[self.navigationController.navigationBar addSubview:view];
表視圖
的問題是圖像不居中導致其大小爲640 x 72 ...有沒有辦法讓它合適?
作爲一種替代方案,您可能可以在代碼中縮放圖像,但這並不是一件有趣的事情,可能比僅僅將圖像設置爲正確的尺寸更麻煩。 – bgoers 2012-07-09 20:07:08
當您嚮導航項添加提示時,圖像會重複出現,並且我們無法將圖像拉伸至導航欄,因此存在問題。 – djleop 2012-12-05 13:51:19