Use resizableImageWithCapInsets on SKSpriteNode

Viewed 1123

I'm currently trying to use a stretchable image on a SKSpriteNode.

Typically, strechable images are returned by the method UIImage::resizableImageWithCapInsets:

So i wrote that code:

SKTexture * texture = [SKTexture textureWithImage:[image resizableImageWithCapInsets:UIEdgeInsetsMake(0, 10, 0, 10)]];
SKSpriteNode * node = [SKSpriteNode spriteNodeWithTexture:texture size:CGSizeMake(150, 8)];

But it don't work. The node streaches itself without taking Edge Insets into account. Is it only possible?

1 Answers
Related