横向模式的 iPhone 应用程序,2008 系统 [英] iPhone app in landscape mode, 2008 systems

查看:26
本文介绍了横向模式的 iPhone 应用程序,2008 系统的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请注意,这个问题来自 2008 年,现在仅具有历史意义.

Please note that this question is from 2008 and now is of only historic interest.

创建从一开始就以横向模式运行的 iPhone 应用程序的最佳方法是什么,而不管设备的位置如何?

What's the best way to create an iPhone application that runs in landscape mode from the start, regardless of the position of the device?

以编程方式和使用界面生成器.

Both programmatically and using the Interface Builder.

推荐答案

仅限历史答案.非常过时.

请注意,这个答案现在已经过时了/

Historic answer only. Spectacularly out of date.

Please note that this answer is now hugely out of date/

这个答案只是历史上的好奇.

令人振奋的消息!正如下面 Andrew 发现的,这个问题已经在 4.0+ 中被 Apple 修复了.

Exciting news! As discovered by Andrew below, this problem has been fixed by Apple in 4.0+.

似乎不再需要在每个视图上强制设置视图的大小,并且景观仅在第一次工作"这一特定严重问题已不再需要.已解决.

It would appear it is NO longer necessary to force the size of the view on every view, and the specific serious problem of landscape "only working the first time" has been resolved.

截至 2011 年 4 月,无法测试甚至构建低于 4.0 的任何内容,因此该问题纯粹是历史性的好奇心.这么长时间给开发者带来了多大的麻烦,真是不可思议!

As of April 2011, it is not possible to test or even build anything below 4.0, so the question is purely a historic curiosity. It's incredible how much trouble it caused developers for so long!

这里是原始讨论和解决方案.现在这完全无关紧要,因为这些系统甚至无法运行.

Here is the original discussion and solution. This is utterly irrelevant now, as these systems are not even operable.

让这项工作完全发挥作用非常困难——至少有三个问题/错误在起作用.

It is EXTREMELY DIFFICULT to make this work fully -- there are at least three problems/bugs at play.

试试这个.. 界面构建器景观设计

特别注意它说并且你需要在任何地方正确使用 shouldAutorotateToInterfaceOrientation",它意味着无处不在,你的所有全屏视图.

Note in particular that where it says "and you need to use shouldAutorotateToInterfaceOrientation properly everywhere" it means everywhere, all your fullscreen views.

希望它对这个噩梦有所帮助!

Hope it helps in this nightmare!

这里有一个重要的众所周知的问题:如果您尝试在 多个 视图(所有横向)之间切换,它根本不起作用.记住这一点很重要,否则你会在这个问题上浪费几天时间.从字面上看这是不可能的.它是 iOS 平台上最大的公开、已知错误.实际上没有办法让硬件成为你加载的第二个视图,是横向的.烦人但简单的解决方法,以及你必须做的,是有一个微不足道的主 UIViewController,它除了坐在那里让你在视图之间切换之外什么都不做.

An important reminder of the ADDITIONAL well-known problem at hand here: if you are trying to swap between MORE THAN ONE view (all landscape), IT SIMPLY DOES NOT WORK. It is essential to remember this or you will waste days on the problem. It is literally NOT POSSIBLE. It is the biggest open, known, bug on the iOS platform. There is literally no way to make the hardware make the second view you load, be landscape. The annoying but simple workaround, and what you must do, is have a trivial master UIViewController that does nothing but sit there and let you swap between your views.

换句话说,在 iOS 中,因为一个重大的已知错误:

In other words, in iOS because of a major know bug:

[window addSubview:happyThing.view];
[window makeKeyAndVisible];

你只能这样做一次.稍后,如果您尝试删除happyThing.view,而是将newThing.view 放入其中,则它不起作用-就是这样.机器永远不会将视图旋转为横向.没有技巧修复,即使是 Apple 也无法让它工作.您必须采用的解决方法是拥有一个整体的 UIViewController,它只是坐在那里并只保存您的各种视图(happyThing、newThing 等).希望有帮助!

You can do that only once. Later, if you try to remove happyThing.view, and instead put in there newThing.view, IT DOES NOT WORK - AND THAT'S THAT. The machine will never rotate the view to landscape. There is no trick fix, even Apple cannot make it work. The workaround you must adopt is having an overall UIViewController that simply sits there and just holds your various views (happyThing, newThing, etc). Hope it helps!

这篇关于横向模式的 iPhone 应用程序,2008 系统的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆