2011-05-30 109 views
0

我正在开发基于窗口的iPhone应用程序。 我想通过增加旋转功能,基于iPhone的旋转窗口应用程序

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

,但它不工作。 这有什么问题。

注意:xCode 4,iOS 4.3

问候。

+0

你在哪里添加了这个方法?应用程序委托或自定义视图控制器? – 2011-05-30 21:10:46

+0

默认情况下,此方法添加到视图控制器中。 – mannan 2011-05-31 11:15:39

+0

您是如何从应用程序代理加载视图控制器的? – 2011-05-31 11:22:41

回答

0

在Xcode 4中,点击左侧栏中最顶端的项目,然后点击摘要选项卡,并确保支持的方向设置正确。

如果是罚款,那么你可以尝试重写回线是这样的:

return(interfaceOrientation == UIInterfaceOrientationPortrait || interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight); 

如果不工作只是尝试return YES;,看看景色会旋转。

+0

我已经试过返回YES;但那也行不通。 – mannan 2011-05-30 19:28:53

+0

实际的问题是,上述方法适用于基于View的应用程序,但它不适用于基于Window的应用程序。 – mannan 2011-05-30 19:32:18

相关问题