UITableViewCell:UITapGestureRecognizer无法识别的选择器发送到实例错误

时间:2016-02-07 00:15:43

标签: ios swift uitableview

我在UITapGestureRecognizer的{​​{1}}上有一个UILabel,我将所述UITableViewCell的目标添加为视图控制器,如:

UITapGestureRecognizer

但是,我收到“UITapGestureRecognizer无法识别的选择器发送到实例”错误。

1 个答案:

答案 0 :(得分:0)

cellForRowAtIndexPath.

上设置手势
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
    let cell = tableView.dequeueReusableCellWithIdentifier("CellIdentifier", forIndexPath: indexPath) as! Cell
    let tap1 = UITapGestureRecognizer(target: self, action:  "selectLabel:")
    cell.label.addGestureRecognizer(tap1)
    return cell
  }