iOS:将视图控制器更改为横向视图

时间:2014-05-24 04:23:51

标签: ios sprite-kit landscape autorotate

我正在使用故事板,所有视图控制器都有导航控制器。该应用程序处于纵向和横向模式。 当我点击按钮时,其中一个视图控制器必须始终处于横向状态。 在研究了stackoverflow中的所有问题后,我仍然找不到任何解决方案。

我正在使用精灵,所以如果自动旋转会搞乱我的精灵节点。

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;
}

0 个答案:

没有答案
相关问题