我有以下代码:
deleteAllButton.setTitle("Delete", forState: .Normal)
deleteAllButton.titleLabel?.numberOfLines = 2
deleteAllButton.setTitleColor(UIColor.blackColor(), forState: .Normal)
deleteAllButton.titleLabel?.font = UIFont.systemFontOfSize(keyboardFontSize)
// deleteAllButton.addTarget(self, action: #selector(deletekeyPressed), forControlEvents: .TouchUpInside)
let deleteLPGR = UILongPressGestureRecognizer(target: self, action: #selector(deleteButtonLongPress))
deleteLPGR.minimumPressDuration = 0
deleteLPGR.delaysTouchesBegan = true
deleteAllButton.addGestureRecognizer(deleteLPGR)
通常,当按下 UIButton 时,文本会自动更改颜色以指示它处于“按下”状态。但是,由于我添加了长按手势识别器,因此该按钮并不表示它处于“按下”状态。
我怎样才能仍然允许触摸事件通过按钮,以便用户感觉按钮实际上是“按下”?