9 scaling a slice in a Sprite set

Does Sprite Kit have an equivalent of 9 slice scaling for sprites?

I tried googling but didn't find anything, but ... often it's a function that has different names in different frameworks. So I could skip this.

+3


source to share


1 answer


SpriteKit supports 9-slices.

https://developer.apple.com/library/ios/documentation/GraphicsAnimation/Conceptual/SpriteKit_PG/Sprites/Sprites.html#//apple_ref/doc/uid/TP40013043-CH9-SW10



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







All Articles