objective c - iOS app background image -


I was trying to add an image (640X1136PX) as the background of a project with the following code:

  SKSpriteNode * background = [SKSpriteNode spriteNodeWithImageNamed: @ "background"]; Background.position = CP pointmake (self size = width * .5, safety .heit * .5); Background.anchorPoint = CPPEXero; Background.blendMode = SKBlendModeReplace; [Self compound: background];  

The background image is shown to the left with the above code, only 10% of the image is showing, if I comment on the following

  Background.anchorPoint = CGPointZero;  

Then it focuses the image but 30% of the area is not covered. Please help me on this, I am very new in the Sprint Kit.

Thanks

Try this approach in your scene-class to get the default values Try leaving anchapoint -properties together.

  - (zero) BuildFileground {self.scaleMode = SKSceneScaleModeAspectFill; Self.background.position = CPECTGetMIDx (self-frame), CGRactGetMediaWeave (self-frame); auto background background. Size = self.frame.size;}  

Comments