Search code examples
textsprite-kitskactionsklabelnode

SKLabelNode change text with SKAction


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


Solution

  • Works using blocks

    SKAction *changeTextAction = [SKAction runBlock:^(void){[self.someLabel setText:@"some string"];}];
    

    Then just run the action

    [self runAction:changeTextAction];