Ios 方向在iPad中不起作用

Ios 方向在iPad中不起作用,ios,ipad,uitableview,orientation,Ios,Ipad,Uitableview,Orientation,我制作了一个iPad应用程序,希望在其中支持方向性,因此我编写了以下代码: - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { //return YES; return (interfaceOrientation==UIInterfaceOrientationPortrait||interfaceOrientation==UIInterfac

我制作了一个iPad应用程序,希望在其中支持方向性,因此我编写了以下代码:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
      //return YES;
    return (interfaceOrientation==UIInterfaceOrientationPortrait||interfaceOrientation==UIInterfaceOrientationLandscapeLeft||interfaceOrientation==UIInterfaceOrientationLandscapeRight);
}

我已经在纵向模式下创建了一些表格,所以当我旋转我的应用程序时,这些表格仍然只在纵向模式下出现,但是我的视图中的表不会自动调整大小。

您需要确保在自动调整大小时,表视图本身设置为在两个方向上展开和收缩-这在IB中最容易设置,方法是单击表视图,然后单击标尺侧边栏标题选项卡,然后确保所有的自动调整大小选项都已打开-调整两个方向的大小,粘贴到所有角落。

您需要记录更多的问题。就像您在UIViewController中使用UIViewController一样?这可能会导致方向问题。我只使用导航控制器和一个视图控制器。我以编程方式创建表视图,因此xib文件中没有任何内容,如果您能提供有帮助的代码段,请查看文档,了解UIView的自动调整大小行为。我不再在代码中进行任何UI组件设置,因为我觉得这是浪费时间,所以我没有示例代码可以共享。