Sprite Kit中的9个切片缩放

时间:2015-05-13 21:49:06

标签: sprite-kit scaling

精灵套件是否具有相当于精灵的9个切片缩放?

我尝试过谷歌搜索,但没有找到任何东西,但是......它通常是一个在不同框架中以不同名称出现的功能。所以我可能会错过它。

1 个答案:

答案 0 :(得分:4)

SpriteKit支持9个切片。

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

该文档没有告诉您设置没有它的大小,所以这里是:

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);