I have a member named _label as an ivar member in class :
@interface CCHelloWorldLayer : CCLayer
{
CCLabelBMFont *_label;
}
in another codeblock: initializing with this line:
_label = [CCLabelBMFont labelWithString:@"Testing " fntFile:fntName];
question is this:
if I want to modify its text what Should I do ?
I dont see any method like:
[_label setString:@"Well.there is no such a method"];
if I do
_label = [CCLabelBMFont labelWithString:@"Testing " fntFile:fntName];
_label = [CCLabelBMFont labelWithString:@"Well.there is no such a method"
fntFile:fntName];
is first memory allocation autoreleasing it self ?
is it safe to recall labelWithString method repeately ?
(note:I dont use ARC in test project.and I wont.)
thanks in advice
There is a
setStringmethod but it appears to be “private”. The+labelWithStringmethod does create an autorelease object and can be used repeatedly. It looks like it creates a texture, so you would want to create a new texture each time (as opposed to trying to modify it).In general though, if you want the autoreleased object to stick around, you should
retainit andreleaseit when you’re done.