我用下面的代碼來改變UINavigationBar的背景:改變UINavigationBar的多重背景的iOS 4.3
代碼:
- (void) drawRect:(CGRect)rect
{
UIImage *image = [UIImage imageNamed:@"NavBar.png"];
[image drawInRect:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
}
所以現在我需要一個以上的背景NavBar2.png ...
如何實現這個?
感謝
您是否爲每個導航欄設置了標籤並試過? – 2012-02-28 13:44:14
@ R.A不,我怎麼能拿到上述方法? – 2012-02-28 13:45:16
爲XIB中的每個導航欄設置標籤,並放置一個if條件來檢查navigationBar.tag並在每個條件中設置不同的圖像 – 2012-02-28 13:48:48