Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/38.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/assembly/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
iphone如何将横向更改为纵向?_Iphone - Fatal编程技术网

iphone如何将横向更改为纵向?

iphone如何将横向更改为纵向?,iphone,Iphone,我用iPhone开发了一个简单的游戏。整个游戏处于横向模式,但记分板页面仅支持纵向模式。我已经检查了这里的问题,我只发现将纵向模式转换为横向模式,但我需要相反的答案。有人能帮我吗?我在AppDelegate中使用了这两个调用。仅在景观中获取游戏中心(记分板) // Supported orientations: Landscape. Customize it for your own needs - (BOOL)shouldAutorotateToInterfaceOrientation:(UI

我用iPhone开发了一个简单的游戏。整个游戏处于横向模式,但记分板页面仅支持纵向模式。我已经检查了这里的问题,我只发现将纵向模式转换为横向模式,但我需要相反的答案。有人能帮我吗?

我在AppDelegate中使用了这两个调用。仅在景观中获取游戏中心(记分板)

// Supported orientations: Landscape. Customize it for your own needs
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return UIInterfaceOrientationIsLandscape(interfaceOrientation);
}



#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_6_0
- (NSUInteger)application:(UIApplication*)application supportedInterfaceOrientationsForWindow:(UIWindow*)window
{
    return UIInterfaceOrientationMaskAllButUpsideDown; //Getting error here? then update ur xcode to 4.5+
}
#endif

Xcode设置:标记横向

这很简单。首先,确保目标摘要中同时支持纵向和横向。然后:

在横向视图控制器中,添加以下内容:

-(NSUInteger)supportedInterfaceOrientations{
    return UIInterfaceOrientationMaskLandscape;
}
-(NSUInteger)supportedInterfaceOrientations{
    return UIInterfaceOrientationMaskPortrait;
}
在纵向视图控制器中,添加以下内容:

-(NSUInteger)supportedInterfaceOrientations{
    return UIInterfaceOrientationMaskLandscape;
}
-(NSUInteger)supportedInterfaceOrientations{
    return UIInterfaceOrientationMaskPortrait;
}

shouldAutorotateToInterfaceOrientation从iOS 6开始就不推荐使用。@WolfLink,是的,我的代码中支持的InterfaceOrientationsForWindow用于iOS 6。。它工作得很好:)无论如何,Thanksher是同一个线程