Ios 为什么';是否要旋转UITableViewController?

Ios 为什么';是否要旋转UITableViewController?,ios,uitableview,Ios,Uitableview,我想让我的UITableViewController仅为横向,但它甚至不会从纵向旋转。。。 我在项目设置中将方向属性设置为横向,并在情节提要中更改了UITableViewController的方向,但仍然没有更改。我该怎么办? 在设备/模拟器上运行,左侧锁定 确保您必须在“项目名称”->“目标”->“信息”中设置这四个方向的支持: 尝试将其添加到viewcontroller.m文件中 - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterf

我想让我的UITableViewController仅为横向,但它甚至不会从纵向旋转。。。 我在项目设置中将方向属性设置为横向,并在情节提要中更改了UITableViewController的方向,但仍然没有更改。我该怎么办? 在设备/模拟器上运行,左侧锁定


确保您必须在“项目名称”->“目标”->“信息”中设置这四个方向的支持:


尝试将其添加到viewcontroller.m文件中

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

所以答案很简单。
我在序列图像板中创建了一个新项目和一个新的UITableViewController,但我正在处理默认的UIViewController类,而不是创建UITableViewController的子类…

在视图控制器中,应该有一个方法
-(BOOL)shouldAutoRotate
,如果返回
NO
FALSE
,这可能就是问题所在。您使用的是什么ios版本?@Mike D:这是一个新项目,应该自动旋转有默认值-是的,那么它可能正在调用此方法:
-(BOOL)应该自动旋转指向面方向:(UIInterfaceOrientation)interfaceOrientation
。()它将列在“在iOS 6.0中不推荐使用”下。此外,如果选择目标,然后选择“摘要”选项卡,则应选择支持的interafce方向。