Swift导航栏项目未调用操作 [英] Swift Navigation Bar item not calling action
本文介绍了Swift导航栏项目未调用操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在导航栏上有一个调用动作的项目.它停止工作了.我已从操作中断开该项目并重新连接.仍然没有动作.动作附在情节提要中.如何调试或解决此问题?
I have an item on the navigation bar that calls an action. It stopped working. I have disconnected the item from the action and re-attached. Still no action. The action is attached in the storyboard. How do I debug or solve this issue?
推荐答案
尝试类似的方法
如果有参数
override func viewDidLoad() {
super.viewDidLoad()
self.navigationItem.rightBarButtonItem = UIBarButtonItem(title: "ButtonName", style: .done, target: self, action: #selector(YourViewController.yourAction(_:)))
}
无参数
override func viewDidLoad() {
super.viewDidLoad()
self.navigationItem.rightBarButtonItem = UIBarButtonItem(title: "ButtonName", style: .done, target: self, action: #selector(YourViewController.yourAction))
}
这篇关于Swift导航栏项目未调用操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文