我有以下代碼:的UIButton不會改變文字顏色,當有長按手勢識別
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按下文本會自動改變顏色以表明它處於「按下」州。但是,由於我添加了長按手勢識別器,該按鈕並不表示它處於「按下」狀態。
如何仍然允許觸摸事件通過按鈕,以便用戶感覺按鈕實際上「按下」?