当手指滑过多个 UIView 时,如何检测特定 UIView 中的触摸
我试图解决的场景是我有几个 UIView 作为主 UIView 的子视图。我想要做的是突出显示视图矩形,例如当手指在视图上滑动时更改其边框。类似于在超文本链接上移动/拖动鼠标光标时发生的情况。
The scenario I am trying to solve is I have several UIViews as subviews of a master UIView. What I want to be able to do is highlight a views rect by lets say changing its border as a finger slides across the view..similar to what happens when you move/drag your mouse cursor over a hypertext link.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以在
touchesMoved:
方法中获取触摸的位置,然后询问主 UIView 哪个视图被触摸:You can get the location of the touch inside your
touchesMoved:
method, then ask the master UIView which view was touched: