Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想知道如果有人按住 UIButton 的按键时间过长,我是否可以捕获 UIButton 的事件(通过通知或其他机制);比单个按钮按下更长 - 假设有人按住按钮几秒钟......
谢谢你。
您可以添加UILongPressGestureRecognizer到您的按钮,在其 中传递一个选择器initWithTarget:action:,并通过设置其minimumPressDuration属性来选择持续时间。
UILongPressGestureRecognizer
initWithTarget:action:
minimumPressDuration