Is there a way I can get an SKLabelNode to change its text property using an SKAction? I would prefer an answer in Swift but one in Objective C will suffice. Thanks
Asked
Active
Viewed 880 times
1 Answers
1
Works using blocks
SKAction *changeTextAction = [SKAction runBlock:^(void){[self.someLabel setText:@"some string"];}];
Then just run the action
[self runAction:changeTextAction];

Micrified
- 3,338
- 4
- 33
- 59
-
Can I also use a block to call a method? – Lahav Aug 27 '15 at 21:13
-
2I believe I am invoking an instance method on the SKLabelNode there through the message I send it, so yes. – Micrified Aug 27 '15 at 21:18
-
Worked like a charm! I'm not sure why Apple hasn't implemented something like this fresh out of the box. It could open doors to many more features (or at least organise the actions related to SKLabelNode in one neat place). Anywho, thanks a lot. – Septronic Dec 19 '15 at 13:17