how to obtain a CCSprite's width and height in cocos2d for iphone

前端 未结 5 1100
离开以前
离开以前 2021-02-02 09:04

That\'s the question xD

Given an instance of a CCSprite in cocos2d in iphone, what method can I use to obtain the image width and height?

5条回答
  •  孤城傲影
    2021-02-02 09:34

    raw width:
    sprite.contentSize.width

    raw height:
    sprite.contentSize.height

    current width: sprite.contentSize.width * sprite.scaleX

    current height: sprite.contentSize.height * sprite.scaleY

提交回复
热议问题