我可以在不覆蓋drawRect
方法的情況下執行此操作嗎?使UIToolBar和UISearchBar具有啞光黑色背景
我已經試過如下:
UIImage *navBarImage = [[UIImage imageNamed:@"image_navbg.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(5, 5, 5, 5)];
[self.descriptionBar setBackgroundColor:[UIColor colorWithPatternImage:navBarImage]];
[self.bottomBar setBackgroundColor:[UIColor colorWithPatternImage:navBarImage]];
凡image_navbg.png是一個堅實的磨砂黑方。我得到的結果仍然有一個黑灰色的漸變。
而且設置這些並沒有幫助:
[self.descriptionBar setTranslucent:YES];
[self.bottomBar setTranslucent:YES];
檢查此答案 - http://stackoverflow.com/questions/4904877/remove-gradient-on-uinavigationbar – kgu87 2012-07-24 01:49:25