问题描述
我正在 cocos2d 中制作游戏,在更新分数时,旧的分数值会出现在标签上,而新的值会被覆盖.我正在使用以下代码来显示分数,
I am making a game in cocos2d , In that while updating score the old score values get on the label and the new value get overwritten. I m using following code to display the score,
LblScore = [CCLabel labelWithString:[NSString stringWithFormat:@"%d",score]
dimensions:CGSizeMake(100, 300)
alignment:UITextAlignmentCenter
fontName:@"Arial"
fontSize:32.0];
因为这个分数值没有显示出来,所有的东西都堆积起来了,如果有人知道如何更新新分数?
Because of this the score value are not shown and all things get massed up, If any one having idea how to update new score?
推荐答案
我的问题的解决方案是,我必须在 -(id)init 方法中定义标签声明,在任何地方提供的值上不会覆盖值.
The Solution for my problem is , I must have to define the label declaration in the -(id)init method, there on the value provided from any where there will be no overwriting of the values.
我已经尝试过了,它正在工作,但仍然感谢所有为我提供帮助的人
I've tried it and it's working, But still thanks to all who provided me a help
这篇关于更新 Cocos2d 中的标签值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!


大气响应式网络建站服务公司织梦模板
高端大气html5设计公司网站源码
织梦dede网页模板下载素材销售下载站平台(带会员中心带筛选)
财税代理公司注册代理记账网站织梦模板(带手机端)
成人高考自考在职研究生教育机构网站源码(带手机端)
高端HTML5响应式企业集团通用类网站织梦模板(自适应手机端)