CCLabelTTF 中的行间距
ios应用程序是否有办法调整cocos2d中CCLabelTTF中多行之间的行距?谢谢
Is there anyway in ios app to adjust the linespacing between the multiple lines in CCLabelTTF in cocos2d? Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
你的问题的答案是否定的。您无法调整 CCLabelTTF 行距。但是嘿!我将与您分享我的解决方案;)
这是 .h
这是 .m
易于使用;)我必须使用 getter、setter 和所有内容来完成该课程。我知道这是一个“自制”解决方案,但是嘿!有用!
The answer to you question is no. You can't adjust a CCLabelTTF linespacing. But hey! I will share with you my solution for this ;)
This is the .h
And this is the .m
Easy to use ;) I have to complete the class with getters, setters and all stuff. I know that this is a "homemade" solution, but hey! It works!
对于使用 Cocos 2d 2.x 的用户,我更改了 @Hardschool 代码来修复已弃用的方法,并且效果非常好!
.h 中
在.m 文件的
就是这样,谢谢@Hardschool!
For those with Cocos 2d 2.x, I changed @Hardschool code to fix the deprecated methods and it's working awesome!
in the .h
in the .m file
That's it, thanks @Hardschool!
gmogames,这里以setColor为例
gmogames, here is setColor for example
我认为这是许多 Cocos2d 开发人员偶然发现的一个问题。因此,为了提高此类的可读性和协作性,我在 Github 上为其创建了一个存储库。
这是链接
我从@gmoagames(和@Hardschool)的版本开始,添加了
setColor:
来自 @Alex 的方法,并添加了一个方法来淡化不透明度。如果您有更多改进,请随时向我发送任何合并请求。
非常感谢这里分享的所有代码。
I think this is an Issue were many Cocos2d Developers stumbled upon. So to improve readability and collaboration on this class I was creating an repository on Github for it.
Here is the link
I startet at the Version of @gmoagames (and @Hardschool), added the
setColor:
Method from @Alex and added a Method to fade the opacity.Feel free to send me any merge requests if you have some more improvements.
And many thanks for all the code that was shared here.