问题
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:
回答1:
Try CGRectMake(0,1-percentageY,1,percentageY)
instead of CGRectMake(0,0,1,percentageY)
来源:https://stackoverflow.com/questions/21874822/trying-to-use-only-a-portion-of-a-sktexture-using-texturewithrect-intexture