我正在写一个应用程序,遇到两个问题。我一整晚都在搜索网页,但没有成功,并想知道这里有没有人可以提供帮助。如何强制UIInterfaceOrientation?
应用程序启动时,我希望它默认为风景模式,并检测它是否在UIInterfaceOrientationLandscapeLeft或UIInterfaceOrientationLandscapeRight。我在.xib文件中以横向模式创建了UI。但是,当我检查self.interfaceOrientation时,无论主页按钮位于iPad模拟器的左侧还是右侧,它总是返回UIInterfaceOrientationLandscapeLeft。
当用户在两个横向之间旋转iPad时,我希望视图发生变化。用一个简单的例子来说明,如果它是UIInterfaceOrientationLandscapeLeft,我想在屏幕的左边写1,在屏幕的右边写2。在UIInterfaceOrientationLandscapeRight中,在屏幕左侧写2,在屏幕右侧写1。 iOS中的哪种方法可以告诉我用户何时旋转设备?
非常感谢。
乔
1.我通过添加的NSLog语句检查它在shouldAutorotateToInterfaceOrientation。这可能不是最好的方法,因为有时它似乎永远不会从shouldAutorotateToInterfaceOrientation返回'是',我添加NSLog后。谢谢,我会检查你提供的链接。 – Joe 2012-01-04 09:26:47