目标C语言 IOS调整CCSprite不工作



我知道这是一个非常愚蠢的问题,但我试着调整大小,它没有反映。

 CCSprite * title;
 title = [CCSprite spriteWithFile:@"flow.png"];
 [title setScaleX:0.55f];
 [title setScaleY:0.55f];

按代码调整精灵大小

-(void)Spriteresize:(CCSprite*)sprite toWidth:(float)width toHeight:(float)height
{
    sprite.scaleX = width / sprite.contentSize.width;
    sprite.scaleY = height / sprite.contentSize.height;
}

如下所示使用此方法

[self Spriteresize:title toWidth:300 toHeight:200];

最新更新