3

我已经以纵向方向开发了我的项目,现在我想将我的项目方向设置为横向。我已将所有 xib 文件的方向属性设置为横向,在 .plist 中我还将支持的界面方向的所有项目设置为横向,但是当我运行我的项目时,一个视图仍然是纵向的......在这个视图中我正在展示pdf文件。

提前致谢 !!!

4

2 回答 2

2

您是否在视图控制器中放入了以下方法

- (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation {
    return YES;
}
于 2011-03-04T08:15:12.993 回答
1

如果景观使用此代码

(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation {
    return (interfaceOrientation==UIInterfaceOrientationLandscapeLeft || interfaceOrientation==UIInterfaceOrientationLandscapeRight);
}

如果肖像使用此代码

(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation {
    return (interfaceOrientation==UIInterfaceOrientationPortrait || interfaceOrientation==UIInterfaceOrientationPortraitUpsideDown);
}
于 2012-05-04T09:14:55.037 回答