我正在尝试在将SKLabelNode
节点添加到自身后更改节点的文本。
这就是我在初始化时创建它的方式:
-(id)initWithSize:(CGSize)size {
if (self = [super initWithSize:size]) {
/* Setup your scene here */
self.backgroundColor = [SKColor colorWithRed:0 green:0 blue:0 alpha:1.0];
// Add label
SKLabelNode *timeLabel = [SKLabelNode labelNodeWithFontNamed:@"timeLabel"];
timeLabel.text = @"5";
timeLabel.fontSize = 100;
timeLabel.position = CGPointMake(CGRectGetMidX(self.frame), CGRectGetMidY(self.frame)+100);
[self addChild:timeLabel];
}
return self;
}
如何更改其文本touchesBegan
?
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
// Change label text?
}