简体   繁体   中英

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. Is this possible on the 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.

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.)

For example, a simple smiley face is  ie \\xe415 on iOS but it is 😄 \\x1f604 on Mac OS. You can verify this by looking at this page on both operating systems.

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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