从 UITextView 复制而不显示键盘

发布于 2024-07-26 23:22:36 字数 234 浏览 1 评论 0原文

我显示一个 UITextView,我希望用户能够从中复制但不能编辑。 复制期间屏幕上不得出现键盘。

如果我阻止第一响应者,那么键盘将保持隐藏状态。 然而,这也阻止了对允许复制交互的触摸事件的处理。 据我所知,它还必须是可编辑的才能处理触摸。

有没有一种简单的方法可以实现这一目标? 只读、仅复制、无键盘的 UITextView? 这些文档非常简洁地介绍了“可编辑”的保证、要求以及如何更改行为。

I display a UITextView that I want the user to be able to copy from but not edit. There must be no keyboard present on the screen during the copy.

If I prevent first responder then the keyboard stays hidden. However this also prevents processing of events from touches that would allow a copy interaction. It also has to be editable to process touches as far as I know.

Is there an easy way to achieve this; a read-only, copy-only, no-keyboard UITextView? The docs are very terse on what "editable" guarantees, requires, and how is changes behavior.

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

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

发布评论

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

评论(1

携君以终年 2024-08-02 23:22:37

您是否尝试过setEditable:NO? 我知道你说文档没有描述太多,但他们确实说它控制接收器是否可编辑。 你试过了吗?

您已经尝试过,答案是将可编辑设置为“否”。

Have you tried setEditable: NO? I know you say the docs don't describe it much, but they do say that it controls whether the receiver is editable. Did you try?

You've tried that, and the answer is to set editable to NO.

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