iOS与Emoji等消息中的文本共享图像 [英] iOS sharing images with text in messages like Emoji

查看:120
本文介绍了iOS与Emoji等消息中的文本共享图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目标是在共享文本到应用程序的SMS消息以及电子邮件中时,能够插入带有文本的图像。如下图所示。当我尝试与UIActivityViewController共享图像时,图像显示在下一行而不是文本旁边。是否可以像内置Emoji文本一样将图像嵌入文本和电子邮件中?

The goal is to be able to insert images with text when sharing text into an SMS Message from the App as well as in e-mails. Like it is in the picture below. When I try to share images with the UIActivityViewController the images appear on the next line and not next to the text. Is it possible to embed images in text and e-mail like the built in Emoji text?

推荐答案

文本消息的内容就是 text (即Unicode代码点的序列)。 )您在屏幕快照中看到的表情符号图片来自所有iOS设备上安装的系统字体,并在文本中以 unicode代码点表示,就像其他常规字体一样

The contents of text messages are just that, text (that is, a sequence of Unicode code points.) The emoji images you see in the screenshot come from a system font installed on all iOS devices, and are represented in the text as unicode code points, just like the other regular letters in the same message.

如果要将自定义图像嵌入到应用程序的文本字段中,则可以创建自定义字体,其中包括所需的图形(对于 Unicode专用区域中的某些代码点),将应用程序中的字体作为资产,配置您的文本字段以使用该字体,然后为用户提供一些UI以便在其中键入这些代码点。

If you want to embed custom images into text fields in your app, you can create a custom font that includes the desired graphics (for some code points in the Unicode private use area,) include the font in your app as an asset, configure your text fields to use that font, and then provide some UI for the user to type those code points in.

但是rem可以看出,这将仅在安装了自定义字体的设备上起作用,并且在选择使用该自定义字体显示文本的应用程序中(实际上仅在您自己的应用程序中)。因此,例如,如果您将电子邮件或iMessage / SMS中的文本发送到另一台设备,则除非a)接收设备在系统范围内安装了自定义字体,并且b)显示文本的应用程序,否则您的自定义图形将无法工作将您选择用于图像的Unicode专用区代码点解析为您的自定义字体。

But remember that this will only work on devices that have your custom font installed, and in apps that choose to use that custom font to display the text — so essentially only in your own app. So for example if you'd send the text in an email or iMessage/SMS to another device, your custom graphics would not work unless a) the receiving device has your custom font installed system-wide, and b) the app displaying the text resolves the Unicode private use area code points you chose to use for your images to this custom font of yours.

如果您只想将图像嵌入自己的文本字段中应用程序,在iOS 7及更高版本上,您可以使用 文本附件 TextKit支持的功能。

If you only want to embed images into text fields within your own app, on iOS 7 and later you can use the text attachments feature that TextKit supports.

这篇关于iOS与Emoji等消息中的文本共享图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆