[英]Custom UIControl gets touchesCancelled when scrolling; how do I disable scroll?
[英]How do I set primaryActionTriggered for a custom UIControl?
我創建了一個自定義 UIControl。 最接近的比較是 UIStepper 但它是 UIControl 的子類,因為它完全是自定義的。
對於大多數 UIControls,您可以使用primaryActionTriggered
創建目標操作,以避免需要知道哪些操作很重要。 我想為我的自定義 UIControl 提供同樣的便利。 那么我如何將 map UIControl.Event.valueChanged
更改為UIControl.Event.primaryActionTriggered
?
我認為如果您正在偵聽valueChanged
事件,那么您只需要在該事件觸發時手動調用sendActions(for: .primaryActionTriggered)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.