문제

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