如何在 cocos2d 中使用属性字符串?
如何将 CCLabelTTF 与 ZAttributedString 一起使用? 假设我想要一个蓝色文本“向世界问好!”但我想要红色的“to”这个词。
how to use CCLabelTTF with ZAttributedString?
Lets say I want a blue Text "Greetings to the World!" but I want the word "to" in red.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
ZAttributedString 是 FontLabel 的一部分,FontLabel 是 Zynga 的外部库,与 Cocos2D 一起打包。 FontLabel 使用 ZFont,而不是 CCLabelTTF 等...
请参阅此处:https://github.com/zynga/FontLabel< /a>
看起来他们提供了一些非常小的示例,您也可以查看他们的单元测试以查看其他用例。
ZAttributedString is part of FontLabel, an external library from Zynga that is packaged with Cocos2D. FontLabel uses ZFont, not CCLabelTTF, etc ...
Refer to here: https://github.com/zynga/FontLabel
It would appear they provide some very small examples, and you can peek into their UnitTests as well to see additional use cases.