我有一个自定义按钮:
let backButton = UIBarButtonItem(title: "<", style: UIBarButtonItemStyle.Plain, target: self, action: "goBack")这就要求:
func goBack() {
self.navigationController?.popToRootViewControllerAnimated(true)
}这是可行的,但相当笨拙。我不想做一个已经是导航控制器方法的方法。为什么我不能让发送方navigationController并将操作设置为popToRootViewControllerAnimated(真)
let backButton = UIBarButtonItem(title: "<", style: UIBarButtonItemStyle.Plain, target: navigationController!, action: "popToRootViewControllerAnimated(true)")发布于 2015-01-18 03:56:35
是的,您可以通过以下更改来实现这一点。
action: "popToRootViewControllerAnimated:"https://stackoverflow.com/questions/28006933
复制相似问题