0
A
回答
1
你不能將按鈕從navBat移回工具欄,但你可以添加自定義按鈕。
self.tabBarController?.navigationItem.hidesBackButton = true
self.navigationController?.toolbarHidden = false
var items = [UIBarButtonItem]()
items.append(
UIBarButtonItem(title: "Back", style: .Plain, target: self, action: #selector(gotoBack))
)
self.navigationController?.toolbar.items = items
,並添加到視圖控制器功能
func gotoBack(){
self.navigationController?.popViewController(animated: true)
}
0
定製navigationController
雨燕3.0
在NavViewController.swift
class NavViewController: UINavigationController,UINavigationControllerDelegate {
var _delegate:UIGestureRecognizerDelegate?
override func viewDidLoad() {
super.viewDidLoad()
_delegate = self.interactivePopGestureRecognizer?.delegate
self.delegate = self
}
func navigationController(_ navigationController: UINavigationController, didShow viewController: UIViewController, animated: Bool) {
//Because it can slide
if viewController != navigationController.viewControllers[0] {
viewController.navigationController?.interactivePopGestureRecognizer?.delegate = nil;
}else{
viewController.navigationController?.interactivePopGestureRecognizer?.delegate = _delegate;
}
}
}
在NextViewC ontroller.swift
override func viewDidLoad() {
super.viewDidLoad()
self.navigationItem.hidesBackButton = true
// Do any additional setup after loading the view.
}
@IBAction func BackButtonItem(_ sender: UIBarButtonItem) {
_ = navigationController?.popViewController(animated: true)
}
0
let toolbar = UIToolbar (frame: CGRect(x: 0, y: 0, width:
self.view.frame.size.width, height: 56))
toolbar.barStyle = UIBarStyle.black
toolbar.sizeToFit()
var items = [UIBarButtonItem]()
items.append(
UIBarButtonItem(title: "Back", style: .plain, target: self, action: #selector(Viewcontroller.BackClicked(sender:)))
)
toolbar.setItems(items, animated: true)
toolbar.tintColor = UIColor.black
self.navigationController?.navigationItem.hidesBackButton = true
self.navigationController?.toolbar.items =項目
func BackClicked(sender: UIBarButtonItem)
{
_ = navigationController?.popViewController(animated: true)
}
相關問題
- 1. Swift - 將功能分配給工具欄按鈕項目
- 2. Swift:爲UINavigationController工具欄添加工具欄按鈕時遇到問題
- 3. 將按鈕添加到Finder工具欄?
- 4. 將按鈕添加到工具欄
- 5. Excel的工具欄按鈕
- 6. 按鈕倒是工具欄
- 7. 工具欄按鈕樣式
- 8. Swing工具欄按鈕
- 9. UINavigationController工具欄按鈕
- 10. 如何使工具欄按鈕比工具欄更大?
- 11. 添加工具欄項目或按鈕DetailViewController工具欄的iPad
- 12. Sencha Touch 2將按鈕添加到工具欄/標題欄
- 13. 將導航按鈕添加到統一標題欄/工具欄
- 14. 如何將後退按鈕添加到操作欄/工具欄
- 15. 如何將Firefox工具欄按鈕放在地址欄附近
- 16. 移動按鈕欄
- 17. 工具欄上移
- 18. 按下工具欄按鈕時重新加載tableview的工具欄
- 19. 在iPad上的標籤欄按鈕和工具欄按鈕不工作
- 20. 從工具欄按鈕呈現UIAlertController
- 21. 工具欄(後退按鈕不顯示)
- 22. 鉻擴展:創建按鈕工具欄
- 23. iPhone攝像頭的工具欄按鈕
- 24. CKEditor - 按鈕切換顯示工具欄
- 25. iOS:後退工具欄按鈕項目
- 26. ExtJS按鈕樣式工具欄
- 27. Firefox工具欄按鈕應該多大?
- 28. Firefox自定義工具欄按鈕
- 29. nicEdit工具欄按鈕部分可見
- 30. 設置工具欄上的按鈕
爲什麼要改變蘋果的UI指南建議是什麼? – NRitH
不是我的慾望,但我同意:/ –