0
A
回答
1
UINavigationBar的用於向後導航或應用轉發。您不能將其用於任何其他功能。如果你想在頂部顯示四個按鈕,使用UIToolBar。工具欄可以具有不同功能的多個按鈕。
`使用工具欄創建新
toolbar = [UIToolbar new];
toolbar.barStyle = UIBarStyleDefault;
[toolbar sizeToFit];
toolbar.frame = CGRectMake(0, 410, 320, 50);
//Add buttons
UIBarButtonItem *systemItem1 = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd
target:self
action:@selector(pressButton1:)];
UIBarButtonItem *systemItem2 = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAction
target:self
action:@selector(pressButton2:)];
UIBarButtonItem *systemItem3 = [[UIBarButtonItem alloc]
initWithBarButtonSystemItem:UIBarButtonSystemItemCamera
target:self action:@selector(pressButton3:)];
//Use this to put space in between your toolbox buttons
UIBarButtonItem *flexItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace
target:nil
action:nil];
//Add buttons to the array
NSArray *items = [NSArray arrayWithObjects: systemItem1, flexItem, systemItem2, flexItem, systemItem3, nil];
//release buttons
[systemItem1 release];
[systemItem2 release];
[systemItem3 release];
[flexItem release];
//add array of buttons to toolbar
[toolbar setItems:items animated:NO];
[self.view addSubview:toolbar];`
相關問題
- 1. 斯威夫特後退按鈕在UINav欄沒有顯示
- 2. 如何添加按鈕到導航欄?
- 3. 添加UIBarButtonItem到UINav..Controller
- 4. 如何將按鈕添加到textfield iphone?
- 5. 如何將PNG添加UIAlert按鈕iphone
- 6. 添加欄按鈕項目
- 7. 如何在UISplitViewController工具欄的右側添加一個按鈕?
- 8. 如何在導航欄上添加2個按鈕?
- 9. 如何在應用欄WP7中添加5個按鈕?
- 10. 添加一個按鈕,標題欄
- 11. iPhone在導航欄中添加項目/行按鈕
- 12. iPhone添加(+)按鈕操作?
- 13. 如何將後退按鈕添加到操作欄/工具欄
- 14. 如何爲ABPersonViewController的導航欄添加一個返回按鈕?
- 15. 如何添加一個按鈕,工具欄和菜單
- 16. 如何在狀態欄上添加按鈕或任何視圖?
- 17. 如何在Drupal7中添加一個按鈕點擊按鈕?
- 18. iOS - XCode 4 - iPhone 6.0 - 將子按鈕添加回子視圖
- 19. iphone sdk:我如何添加一個按鈕到uitableviewCell?
- 20. 如何在工具欄的按鈕上添加信息?
- 21. 如何在標籤欄中添加按鈕
- 22. 如何添加按鈕在工具欄程序
- 23. 如何在搜索欄左側添加按鈕?
- 24. 如何在界面構建器中添加欄按鈕項?
- 25. 如何在MFC工具欄中添加純文本按鈕
- 26. 如何在菜單欄中添加單選按鈕,qt 5 C++
- 27. 如何在標籤欄項目中添加信息按鈕?
- 28. 如何在工具欄中的按鈕下添加標籤?
- 29. 如何在Quill工具欄中添加對齊按鈕?
- 30. 如何在controller.rb中添加按鈕鏈接 - rails 4