1
我添加了一個子視圖細胞:UITableViewCell不會將觸摸事件傳遞給子視圖,爲什麼?
override func tableView(tableView: UITableView!, cellForRowAtIndexPath indexPath: NSIndexPath!) -> UITableViewCell! {
let l = MEL()
l.userInteractionEnabled = true
cell.contentView.addSubview(l)
return cell
}
,但是當我接觸標籤,touchesEnded不會被調用,爲什麼呢?
class MEL: UILabel {
override func touchesEnded(touches: NSSet!, withEvent event: UIEvent!) {
super.touchesEnded(touches, withEvent: event)
在MEL中覆蓋'func touchesCancelled(_ touches:NSSet!, withEvent event:UIEvent!)'並檢查觸摸是否被取消 – Akhilrajtr 2014-08-28 12:23:27
'touchesCancelled'沒有被調用 – 2014-08-28 12:26:06