9 scaling a slice in a Sprite set
1 answer
SpriteKit supports 9-slices.
The doc doesn't tell you to set the size, which won't work without it, so here it goes:
SKSpriteNode *button = [SKSpriteNode spriteNodeWithImageNamed:@"stretchable_button.png"];
button.centerRect = CGRectMake(12.0/28.0, 12.0/28.0, 4.0/28.0, 4.0/28.0);
button.size = CGSizeMake(100.0, 50.0);
+4
source to share