【发布时间】:2014-09-08 23:31:42
【问题描述】:
我正在尝试向 buttonClicked 操作传递一个额外的参数,但无法确定 Swift 中的语法。
button.addTarget(self, action: "buttonClicked:", forControlEvents: UIControlEvents.TouchUpInside)
我的任何 buttonClicked 方法:
func buttonClicked(sender:UIButton)
{
println("hello")
}
有人有什么想法吗?
感谢您的帮助。
【问题讨论】:
-
参考this link获取详细答案和最佳实践
-
这个问题没有很好的答案,因为它已经描述了一个有问题的架构。您不需要额外的参数。需要 n 个附加参数是您的架构中的一个问题。
-
WARNING TO INTERNET: please check out my answer at the bottom