[英]touchUpInside event on a UINavigationItem
In my app's main view, I have a button that segues to a subclassed UINavigationController
holding a UITableViewController
to change settings. 在我的应用程序的主视图中,我有一个按钮可以连接到一个子类
UINavigationController
,该子类持有一个UITableViewController
来更改设置。
To get back to the app's main view, I have this in the UINavigationController
subclass: 回到应用程序的主视图,我在
UINavigationController
子类中具有此功能:
navigationBar.setItems([UINavigationItem(title: "Back"),
UINavigationItem(title: "Settings")],
animated: false)
When I tab the Back button, the app segues back to the same view - but the navigation bar now only have the Settings item. 当我点击“后退”按钮时,该应用会重新显示为同一视图-但导航栏现在仅具有“设置”项。
When I click the Back button, I want to dismiss the UINavigationController
subclass and come back to my main view. 当我单击“后退”按钮时,我想关闭
UINavigationController
子类并返回到主视图。
So how do I get a touchUpInside
event on the UINavigationItem
or is there some other way I can do this? 那么如何在
UINavigationItem
上获取touchUpInside
事件,或者还有其他方法可以做到这一点?
So it turns out there's a very easy way of doing this: 事实证明,有一种非常简单的方法:
UIBarButtonItem
in the storyboard UIBarButtonItem
中添加UIBarButtonItem
UITableViewController
UITableViewController
UIBarButtonItem
to the UITableViewController
subclass to create an action UIBarButtonItem
拖动到UITableViewController
子类以创建操作 UITableViewController
in the action UITableViewController
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.