简单地继承 UITouchGestureRecognizer,设置 minimumPressDuration
Simply subclass UITouchGestureRecognizer, setting minimumPressDuration
我只是想做这样的事情:
class UITouchyGestureRecognizer: UILongPressGestureRecognizer {
required init? .. something .. {
super.init .. who knows ..
print("wth?")
minimumPressDuration = 0
}
}
但是我已经彻底放弃了,因为我试了大概20种方法都搞不定
怎么办?
最简单的子类是:
class UITouchyGestureRecognizer: UILongPressGestureRecognizer {
override init(target: Any?, action: Selector?) {
super.init(target: target, action: action)
minimumPressDuration = 0
}
}
但是如果你想使用 init(coder...) 然后 .addTarget(target: Any, action:Selector)
class UITouchyGestureRecognizer: UILongPressGestureRecognizer {
required init?(coder aDecoder: NSCoder) {
super.init(target: nil, action: nil)
print("wth?")
minimumPressDuration = 0
}
}
我只是想做这样的事情:
class UITouchyGestureRecognizer: UILongPressGestureRecognizer {
required init? .. something .. {
super.init .. who knows ..
print("wth?")
minimumPressDuration = 0
}
}
但是我已经彻底放弃了,因为我试了大概20种方法都搞不定
怎么办?
最简单的子类是:
class UITouchyGestureRecognizer: UILongPressGestureRecognizer {
override init(target: Any?, action: Selector?) {
super.init(target: target, action: action)
minimumPressDuration = 0
}
}
但是如果你想使用 init(coder...) 然后 .addTarget(target: Any, action:Selector)
class UITouchyGestureRecognizer: UILongPressGestureRecognizer {
required init?(coder aDecoder: NSCoder) {
super.init(target: nil, action: nil)
print("wth?")
minimumPressDuration = 0
}
}