横向方向切换为纵向

时间:2012-07-19 18:14:10

标签: xcode interface orientation landscape autorotate

我是新来的,我有一个问题。我搜索了网络,找到了我的问题的答案,他们似乎为其他人工作。但不适合我。

我正在横向视图中构建一个iPad应用程序(使用故事板的Xcode 4.3.3)(右) 它在横向视图中启动,但是当我单击按钮(segue - 模态 - 默认)跳转到我的下一个视图时,应用程序将跳转到纵向视图。

我已添加此代码并尝试了很多种类(在本网站上给出)

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationLandscapeRight); }

- 将我的视图控制器设置为横向模式而不是推断。

- 为我的plist文件添加了初始界面方向。

但无论我做什么,似乎都没有正常工作。 我做错了什么?

我已将我的Xcode文件上传到我的服务器,以便您自己检查我的代码。 download zip.

我希望你们能帮助我, 非常感谢!

玛特

1 个答案:

答案 0 :(得分:0)

使用以下方法创建另一个类ViewControllerPushed

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationLandscapeRight); }

然后将其设置为您在 storyboard 中推送ViewController的类。