This does not work:
CCSprite *testscale=[CCSprite spriteWithSpriteFrame:starFrame];
testscale.scale=0.5;
float starWidth=testscale.contentSizeInPixels.width;
CCLOG(@"contentpixels: %f contentsize: %f",starWidth, testscale.contentSize.width);
The two outputs in CCLOG both show the original pixel size of the sprite, not the size after scaling.
Is there a way to get it without doing this?…
float displayWidth=starWidth*testscale.scale;
Use the boundingBox property of CCNode:
This should give you the width and height you want, taking into account any transformation (scaling, rotation) you have made to the sprite.