更改viewcontroller后iPhone视图uiorientation无法正常工作

时间:2009-11-27 16:41:29

标签: iphone

我有2个视图控制器,当应用程序在第一个视图中时,orignal视图uiorientation工作正常但是当我切换视图并返回到第一个视图时,uiorientation不起作用。我试图让第一个观点成为第一反应但没有运气。

我可以做些什么来解决这个问题?

2 个答案:

答案 0 :(得分:0)

您是否尝试在视图控制器中实现- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation方法?

例如,对于横向:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}

答案 1 :(得分:0)

您必须在Info.plist中添加一行:

键:UIInterfaceOrientation值:UIInterfaceOrientationLandscapeRight;

然后才会开始工作。

希望这有帮助。