What I'm doing is create a SKTexture based on the full image

SKTexture *fullTexture = [SKTexture textureWithImageNamed:@"fullImage"];

I want to use the full width of the fullTexture, but only a portion of height of the texture, BUT, starting from the TOP of the full image.

After figuring out that the width seems to be in percentage, I used the following code:

SKTexture *croppedTexture = [SKTexture textureWithRect: CGRectMake(0,0,1,percentageY)

can somebody give me the correct float values for CGRectMake to CROP, beginning from the TOP LEFT, with full witdt and only a portion (fixed number of points/pixels) from the Y ?

OR another way to achieve what I am trying to do?

Thanks

Updated the question with visible example of what I need:

enter image description here

有帮助吗?

解决方案

Try CGRectMake(0,1-percentageY,1,percentageY) instead of CGRectMake(0,0,1,percentageY)

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top