从子类 UIPasteboard 选择中获取 NSRange

发布于 2024-08-26 11:32:22 字数 159 浏览 4 评论 0原文

我想知道是否有某种方法可以子类化 UIPasteboard 以获得选择行为,但不能获得“剪切、复制和粘贴”选项。除此之外,是否有一些我可以订阅的通知,一旦选定文本正文就会返回其 NSRange?

感谢您的帮助!

编辑:我想使用这个子类来允许用户指示他们想要运行函数的区域。

I am wondering if there is some way to subclass UIPasteboard in order to get the selection behavior, but not get the "Cut, Copy, and Paste" options. In addition to this, is there some notification I can subscribe to that returns the NSRange of the selected body of text once it is selected?

Thanks for any help!

EDIT: I would like to use this subclass to allow the user to indicate the area that they would like to run a function on.

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

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

发布评论

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

评论(1

め七分饶幸 2024-09-02 11:32:22

UIPasteboard 支持两个通知

  • UIPasteboardChangedNotification
  • UIPasteboardRemovedNotification

我已经浏览了相关文档,但没有看到任何获取范围的方法的选择。

未来的操作系统版本可能会在这方面提供更多支持。

There are two notifications supported by UIPasteboard:

  • UIPasteboardChangedNotification
  • UIPasteboardRemovedNotification

I've looked through the relevant docs and not seen any way to get a range of the selection.

It's possible that future OS versions might give a little more support in this area.

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