是否可以在自定义类中获取按钮触摸事件类型(即touchupinside,touchupoutside,touchdragdown等)。
class MyButton : UIButton {
override func sendAction(_ action: Selector, to target: Any?, for event:
UIEvent?) {
debugPrint("Am here")
/* below code is just for understanding what i want
if event.type == touchupinside {
//do something
}
else if event.type == touchdragdown {
//do something else
}
*/
super.sendAction(action, to: target, for: event)
}
}