Todd
Todd

Reputation: 153

Sprite Kit Coordinates Reversed order

I haven't had this problem before, so I'm wondering if it's a bug.

NSLog(@"%f %f", self.frame.size.height, self.frame.size.width);

is giving me

768.000000 1024.000000

And my app is only set to allow portrait mode. What???

Upvotes: 0

Views: 146

Answers (2)

Romeo
Romeo

Reputation: 1

For Xcode 6 in GameScene.m put this:

-(void)didMoveToView:(SKView *)view {

 /* Setup your scene here */

    self.size = self.view.frame.size;


}

Upvotes: 0

Andriko13
Andriko13

Reputation: 990

You must be using SpriteKit. You need to make sure to resize the screen by using self.size = self.frame.size; inside your initWithSize:(CGSize)size method of the class you're using (the default would be gameScene).

Essentially:

-(id)initWithSize:(CGSize)size {    
if (self = [super initWithSize:size]) {
    /* Setup your scene here */

    self.size = self.frame.size;

    // Your code here

    };
return self;
}

Upvotes: 1

Related Questions