【发布时间】:2012-08-20 07:44:59
【问题描述】:
我在我的 iPhone 应用程序中遇到了一个奇怪的问题。我希望我的应用仅支持纵向模式,但由于某种原因我无法做到(设备和模拟器)。
为了只支持纵向模式,我做了如下操作:
In the TARGET summary section on Xcode, I chose only portrait.
All my ViewControllers implements shouldAutorotateToInterfaceOrientation
但正如我所说,它不起作用,奇怪的结果是应用程序支持所有方向(纵向、倒置、横向左侧、横向右侧)。 有什么想法吗?
这就是我实现 shouldAutorotateToInterfaceOrientation 的方式
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
NSLog(@"Checking orientation %d", interfaceOrientation);
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
非常感谢。
【问题讨论】:
标签: iphone orientation portrait