如何在導航欄左側有一個後退按鈕和另一個按鈕?因爲這是一個iPad應用程序,有多個按鈕的空間。但我只能得到它顯示每對navigationitem側一個鍵...在同一側有多個按鈕的iPad應用導航欄
1
A
回答
-1
+1
不幸的是,鏈接被破壞 – 2011-08-10 12:21:22
2
對於誰在這裏絆倒和斷開的鏈接感到失望的人,看看這篇文章:
http://osmorphis.blogspot.com/2009/05/multiple-buttons-on-navigation-bar.html
2
iOS現在支持同一側的多個按鈕。從UINavigationItem文檔:
自定義視圖
titleView property
leftBarButtonItems property
leftBarButtonItem property
rightBarButtonItems property
rightBarButtonItem property
– setLeftBarButtonItems:animated:
– setLeftBarButtonItem:animated:
– setRightBarButtonItems:animated:
– setRightBarButtonItem:animated:
所以,基本上,你會寫這樣的事情在左邊添加兩個按鈕:
UIBarButtonItem *refreshBtn = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemRefresh target:self action:@selector(refreshPlans:)];
UIBarButtonItem *selectYearBtn = [[UIBarButtonItem alloc] initWithTitle:@"Select Year" style:UIBarButtonSystemItemAction target:self action:@selector(selectYear)];
self.navigationItem.leftBarButtonItems = [[NSArray alloc] initWithObjects: refreshBtn, selectYearBtn, nil];
不幸的是,我的天堂」沒有看到在故事板中執行此操作的方法。希望這可以幫助。
+0
「不幸的是,我還沒有看到在故事板中做到這一點的方法。」請看下面的答案。你會看到我用來在滑板中使用它的技巧 – HpTerm 2012-12-18 08:46:28
0
UIBarButtonItem *btn0 = [[UIBarButtonItem alloc] initWithTitle:@"1" style:UIBarButtonItemStylePlain target:self action:@selector(tapLevel0)];
UIBarButtonItem *btn1 =[[UIBarButtonItem alloc] initWithTitle:@"<2" style:UIBarButtonItemStylePlain target:self action:@selector(tapLevel1:)];
UIBarButtonItem *btn2 = [[UIBarButtonItem alloc] initWithTitle:@"<3" style:UIBarButtonItemStylePlain target:self action:@selector(tapLevel2:)];
UIBarButtonItem *space = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil];
space.width = 10;
UIBarButtonItem *space2 = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil];
space2.width = 10;
// UIBarButtonItem *refreshButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemRefresh target:self action:@selector(refreshItem)];
self.navigationItem.leftBarButtonItems = [NSArray arrayWithObjects:btn0, space, btn1, space2, btn2, nil];
相關問題
- 1. 設置導航欄背部按鈕右側的按鈕iPad monotouch
- 2. 帶有多個按鈕的導航欄
- 3. 在Xcode的導航欄左側添加一個按鈕
- 4. 有兩個對應側邊欄和導航欄的摺疊按鈕,每次只需要一個擴展按鈕
- 5. 自定義右側導航欄按鈕
- 6. 設置左側按鈕的重用導航欄項目按鈕
- 7. 導航欄上的多個按鈕
- 8. 額外的按鈕(一個或多個)在MonoTouch的導航欄
- 9. 如何隱藏導航欄中兩個右側按鈕之一
- 10. MaterializeCSS導航欄按鈕不觸發側導航
- 11. 導航欄按鈕
- 12. 添加另一個按鈕導航欄
- 13. 側欄導航
- 14. 導航欄左側的1個以上按鈕
- 15. 每個導航欄按鈕左側的CSS空白空間
- 16. 側導航摺疊按鈕
- 17. Ipad類型導航按鈕
- 18. 我們可以在iPhone應用程序的導航欄左側有一個電子郵件按鈕嗎?
- 19. 用於右側導航欄按鈕項的翻頁動畫
- 20. 使用導航欄左側的按鈕發出問題
- 21. 對齊按鈕在文本右側的導航欄
- 22. 導航工具欄右側兩個按鈕
- 23. 側欄導航改爲導航欄中的頂部導航欄
- 24. 有UITableView的編輯按鈕,導航欄
- 25. 導航欄按壓按鈕右側打破
- 26. 兩側導航欄
- 27. 導航欄左側
- 28. 側欄移動時懸停在導航按鈕
- 29. 導航欄後退按鈕顏色在iPad中不工作
- 30. 導航欄和按鈕
如果此問題不需要任何關注,請刪除它或將其標記爲已回答。 – 2011-01-02 17:31:13