UIButton 子类在弹出和 UIAlertView 后持续高亮

发布于 2024-08-11 14:08:10 字数 296 浏览 0 评论 0原文

我正在子类化 UIButton 并检测手指运动,如果用户以某种方式滑动手指,我将弹出 UIAlerView。

一切都很好,除了在关闭 UIAlertView 之后...当用户下次触摸 UIButton 时,按钮会进入突出显示状态并卡在那里,持续突出显示,即使没有手指触摸它。

再次按下按钮,UIButton 开始正常运行(仅在触摸时突出显示)。

所以我只能假设滑动期间的警报会搞砸事件的过程,touchesEnded 可能永远不会触发?

如果有人对如何在滑动后“重置”按钮有任何想法,以便其表现应有,我将不胜感激。

I am subclassing a UIButton and detecting finger movements, if the user swipes his finger in a certain way I will pop up an UIAlerView.

All good, except that after dismissing the UIAlertView... when the user next touches the UIButton the button goes to it's highlighted state and gets stuck there, continuously highlighted, even when no finger touching it.

Pressing the button again the UIButton begins to behave normally (only highlights when touched).

So I can only presume that an alert during a swipe, screws up the process of events, the touchesEnded never firing perhaps?

If anyone has any ideas on how to 'reset' the button after the swipe so that it behaves as it should, I would be grateful.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

弥枳 2024-08-18 14:08:10

你正在重置touchesCancelled的状态吗?

Are you resetting your state in touchesCancelled?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文