在 iPhone 应用程序的 UITextView 中禁用放大镜
我想显示文本,并且希望能够知道用户触摸了文本中的位置。因为文本可能很长,所以我想使用 UITextView 来处理换行和所有内容。我想要在触摸开始或移动时进行自己的事件处理。我的问题是放大镜和选择/选择所有菜单正在中断我的 TouchMoved 事件。
如何禁用放大镜,但仍启用用户交互以便我可以检测触摸?
I want to display text and I want to be able to know where in this text a user touches. Because the text could be long, I wanted to use a UITextView so that wrapping and everything would be taken care of. I want my own event handling for when a touch begins or moves. My problem is that the magnifying glass and select/select all menu are interrupting my touchesMoved events.
How can i disable the magnifying glass, but still have user interaction enabled so that I can detect the touches?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您必须创建一个子类并重写这两个函数以禁用
select/select all/copy/
和magnifying
select/select all/copy/< /code>
:
参考:
https://stackoverflow.com/a/1429320/1526023
放大
:参考:
https://stackoverflow.com/a/10641203/1526023
You have to create a subclass and override these two functions to disable
select/select all/copy/
andmagnifying
select/select all/copy/
:Reference:
https://stackoverflow.com/a/1429320/1526023
magnifying
:Reference:
https://stackoverflow.com/a/10641203/1526023
我建议检查 gestureRecognizers 属性。
您会在数组中找到很多它们,并且可能想要将它们全部删除,或者找到触发您想要拦截并删除/替换的事件的事件。
我用它从 UITextField 中删除复制/粘贴和放大镜功能
I'd suggest to check the gestureRecognizers property.
You will find a lot of them in the array and might want to either remove them all or to find the ones that triggers the event you want to intercept and remove/replace it.
I used it to remove copy/paste and magnifying glass functionalities from an UITextField
您可以尝试此处提供的提示:
如何在 UITextView 中禁用复制、剪切、选择、全选
You might try the tips offered here:
How disable Copy, Cut, Select, Select All in UITextView