我在UITapGestureRecognizer
的{{1}}上有一个UILabel
,我将所述UITableViewCell
的目标添加为视图控制器,如:
UITapGestureRecognizer
但是,我收到“UITapGestureRecognizer无法识别的选择器发送到实例”错误。
答案 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
}