【发布时间】:2013-05-07 03:31:40
【问题描述】:
我正在使用此代码为我的 iOS 应用程序锁定横向模式。
#pragma mark Orientation handling
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationMaskAllButUpsideDown);
}
-(BOOL)shouldAutorotate
{
return YES;
}
-(NSUInteger)supportedInterfaceOrientations
{
return (UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskPortraitUpsideDown);
}
它在 iPhone 上运行良好,但在 iPad 上运行不正常。它不会锁定横向模式。
需要一些指导。
【问题讨论】:
-
您也可以在 Xcode 的摘要选项卡中为您的应用设置方向。
-
我的一些屏幕需要它们处于横向模式。这就是为什么我以编程方式进行...
-
你的结果是什么?它是自动旋转的吗?
-
iPad版自动旋转...
-
在 shouldAutorotateToInterfaceOrientation 上放置断点。开火了吗?