2010-07-15 469 views
1

我想在導航欄的左側有兩個按鈕,一個是常規後退按鈕,另一個是UIBarButtonItem。不過,我只能讓它取代默認的後退按鈕。我已經在互聯網上嘗試了很多代碼示例,但無法工作。請幫忙自定義導航控制器的後退按鈕

回答

0

據我所知,目前在UINavigationBar的兩側都沒有(目前)可以有兩個UIBarButtonItems

0

爲此,您必須使用UIToolBar多個按鈕導航控制器上

0

是的,你可以這樣做副

UIButton *backBtn = [UIButton buttonWithType:UIButtonTypeCustom]; 
UIImage *homeImage = [UIImage imageNamed:@"YOUR_IMAGE.png"]; 
[backBtn setBackgroundImage:homeImage forState:UIControlStateNormal]; 
[backBtn addTarget:self action:@selector(YOUR_ACTION) 
forControlEvents:UIControlEventTouchUpInside]; 
backBtn.frame = CGRectMake(0, 0, 69, 26); 
UIBarButtonItem *button1 = [[UIBarButtonItem alloc] initWithCustomView:backBtn]; 
[[self navigationItem] setLeftBarButtonItem:button1]; 
[button1 release]; 
button1 = nil; 
相關問題