如何打造“热点区域” UIControl 更大吗?

发布于 2024-08-02 08:01:13 字数 167 浏览 2 评论 0原文

或者:如何扩展 UIControl 的敏感区域而不只是使视图更大?

我有一个非常小的按钮图像(一个小箭头),只有 10 x 10 像素。太小了,无法触摸。我希望“热点区域”的大小为 50 x 50 左右。为了学习,我想知道如何手动执行此操作,即使我可以使用一些提供的 UIControls 来实现此目的。

Or: How to expand the sensitive area for a UIControl without just making the view bigger?

I have a pretty small button image (a little arrow), which is just 10 x 10 pixels. Too small for touching. I want the "hot area" to be 50 x 50 around that. For learning, I want to know how to do it manually, even if I could use some of the provided UIControls for this purpose.

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

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

发布评论

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

评论(1

古镇旧梦 2024-08-09 08:01:13

您始终可以在顶部放置另一个视图 - 也许将 UIButton 设置为自定义类型,因此它是不可见的 - 并让该按钮在被触摸时触发您想要发生的事情。

但您的真正问题是首先使用 10x10 像素区域进行用户控制。我能想到的最小的用户控件(例如,在日历应用程序中)具有大约 30x30 的 [+] 按钮区域。

想想你的用户,问问自己他们在处理微小控件时会有什么体验。

You could always layer another view over top -- perhaps a UIButton set to custom type so it's invisible -- and have that button trigger what you want to happen when it gets touched.

But your real issue is using 10x10 pixel areas for user control in the first place. The smallest user control I can think of (say, in the Calendar app) has about a 30x30 area for the [+] button.

Think of your users and ask yourself what their experience will be dealing with tiny little controls.

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