简体   繁体   English

NSTextView中的表情符号

[英]Emoji in NSTextView

I'm writing a Twitter app for Mac OS X. I want to show emoji (people sent them on their iOS devices) in NSTextView. 我正在为Mac OS X编写一个Twitter应用。我想在NSTextView中显示表情符号(人们在他们的iOS设备上发送了表情符号)。 Is this possible on the Mac? 在Mac上可以吗? If so, how can I achieve this? 如果是这样,我该如何实现?

Thank you in advance. 先感谢您。 Any help would be appreciated. 任何帮助,将不胜感激。

Kai

Note that iOS and Mac OS X Lion use different unicode code points to represent the same emoji character. 请注意,iOS和Mac OS X Lion使用不同的unicode代码点来表示相同的表情符号字符。

The iOS unicode values are documented here: http://pukupi.com/post/1964/ while the Mac OS X Lion ones are documented here: http://www.unicode.org/~scherer/emoji4unicode/snapshot/emojidata.pdf (actually both are documented in that .pdf. OS X 10.7 Lion uses the proposed Unicode standard encoding, while iOS 5 uses the SoftBank column.) iOS unicode值记录在这里: http : //pukupi.com/post/1964/,而Mac OS X Lion值记录在这里: http : //www.unicode.org/~scherer/emoji4unicode/snapshot/emojidata。 pdf (实际上两者都在该pdf中记录。OS X 10.7 Lion使用建议的Unicode标准编码,而iOS 5使用SoftBank列。)

For example, a simple smiley face is  ie \\xe415 on iOS but it is 😄 \\x1f604 on Mac OS. 例如,一个简单的笑脸是,即iOS上的\\ xe415,但在Mac OS上是😄\\ x1f604。 You can verify this by looking at this page on both operating systems. 您可以通过在两个操作系统上查看此页面来验证这一点。

您应该能够通过在字符串中搜索所有出现的emoji表情并将其替换为自定义NSTextAttachment实例的实例来完成此操作,该实例会内联绘制适当的图标。

表情符号将出现在狮子中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM