如何创建一个缩放图像以适应输入边界的CCSprite,即如果我想要一个宽度= 70且高度= 50的CCSprite,并将文件中的图像缩放到70,50.除了从图像的大小计算比例因子与期望的最终大小相比之外,还
@implementation CCSprite(Resize) -(void)resizeTo:(CGSize) theSize { CGFloat newWidth = theSize.width; CGFloat newHeight = theSize.height; float startWidth = self.contentSize.width; float startHeight = self.contentSize.height; float newScaleX = newWidth/startWidth; float newScaleY = newHeight/startHeight; self.scaleX = newScaleX; self.scaleY = newScaleY; } @end