0

I am using storyboard and all the view controllers have navigation controller. The app is at portrait and landscape mode. One of the view controllers must always in landscape when I tapped a button. After researched all the questions in stackoverflow, I still cannot find any solutions.

I am using sprite so if auto-rotate will messed up my sprite nodes.

enter image description here

- (void)viewDidLoad
{
[super viewDidLoad];
// Configure the view.
SKView * skView = (SKView *)self.view;
skView.showsFPS = YES;
skView.showsNodeCount = YES;

// Create and configure the scene.
SKScene * scene = [MyScene sceneWithSize:skView.bounds.size];
scene.scaleMode = SKSceneScaleModeAspectFill;

// Present the scene.
[skView presentScene:scene];
}

-(BOOL)shouldAutorotate
{
    return NO;
}

-(NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskLandscape;
}

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
    return UIInterfaceOrientationLandscapeRight;
}
shoujo_sm
  • 3,173
  • 4
  • 37
  • 60
  • Your posted code is the standard template code. What other code have you tried? A simple google search also provides answers on how to code switching orientation in SKScene. http://stackoverflow.com/questions/22025967/spritekit-support-multiple-device-orientations – sangony May 24 '14 at 14:06
  • This is not what I want. I want to force rotate the view. Your link is only detect the orientation and do your stuff after user change orientation. Thank you. – shoujo_sm May 25 '14 at 07:22
  • You might find the answer here: http://stackoverflow.com/questions/23011766/force-change-interface-orientation-between-scenes – ZeMoon May 26 '14 at 08:57
  • Hi, I am getting blank black screen by using the two codes on my landscape view controller. – shoujo_sm May 26 '14 at 16:38

0 Answers0