[Prev] Thread [Next]  |  [Prev] Date [Next]

[cocos2d-iphone] Re: How do I retrieve the string from a Label once it has been set? riq Mon Mar 30 13:02:20 2009

> With no accessor method for Label objects, I cannot access the text in
> the Label of the sprite. I want to know what methods are available to
> access the sprite->label->text.
> Any suggestions?

With the current API you can't get the current text of the Label.
Of course you can subclass Label and override setString.

If you use LabelAtlas you will be able to obtain the text by adding
converting the ivar "string" into a property.

As Andy said, perhaps there other approaches to achieve what you want.
Perhaps you can use tags. All CocosNode have tags. A tag is the number
that you want and you can get nodes by Tag.



Did you read the cocos2d documentation? http://tinyurl.com/b8cqm3
Please, read it before asking for help. Probably your answer is there.