确定 iPhone 上 uipasteboard 文本中使用的字体

发布于 2024-08-14 15:58:54 字数 245 浏览 3 评论 0原文

这是场景:
用户使用混合字体复制随机文本。
如何确定使用的字体?
当文本从 UIPasteboard 粘贴到文本视图中时,它会正确显示混合字体,因此我相信该信息是可用的。

UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
textView.text = pasteboard.string;

任何帮助将不胜感激!

Here is the scenerio:

The user copies random text with mixed fonts.
How do I determine the font(s) used?
When the text is pasted from the UIPasteboard into a textview it correctly shows the mixed fonts, so I believe the information is available.

UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
textView.text = pasteboard.string;

Any Help would be much appreciated!

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

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

发布评论

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

评论(2

忘年祭陌 2024-08-21 15:58:55

而不是调用 [pb string],您可能需要使用 [pb dataForPasteboardType:@"public.rtf"]。

instead of calling [pb string], you may want to use [pb dataForPasteboardType:@"public.rtf"].

白况 2024-08-21 15:58:55

它可能是“public.html”而不是“public.rtf”。您应该能够迭代可用的类型,以查看其他应用程序将哪些内容放入粘贴板,然后做出相应的反应。

It might be "public.html" instead of "public.rtf". You should be able to iterate over the types available to see what the other app is putting into the pasteboard, then react accordingly.

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