【问题标题】:Pass multiple parameters to #selector [duplicate]将多个参数传递给#selector [重复]
【发布时间】:2016-10-25 22:07:17
【问题描述】:
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
    let cell = tableView.dequeueReusableCellWithIdentifier("MyCell", forIndexPath:indexPath) as! MyTableViewCell
    cell.myButton.addTarget(self, action: "myClick:", forControlEvents: .TouchUpInside)
}

func myClick(sender: UIButton) {

} 现在,我想将另一个参数传递给发件人: UIButton , 那我怎么才能通过呢?

【问题讨论】:

    标签: swift methods


    【解决方案1】:

    您可以发送的唯一参数是 sender,在您的情况下是 UIButton。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-12-12
      • 1970-01-01
      • 2018-06-29
      • 1970-01-01
      相关资源
      最近更新 更多