容器视图中ViewController内的Tableview在旋转时更改布局

时间:2016-07-07 07:10:23

标签: ios uitableview uiviewcontroller uicontainerview cgsize

我在viewController中保留了一个tableview.ViewController在容器视图中。

问题是布局在设备旋转时会发生变化。 这不是约束问题,因为它仅在旋转时发生。

这就是我所做的

-(void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
{

    CGSize contentSize = self.affiliationListTableView.contentSize;
    contentSize.width = self.affiliationListTableView.superview.superview.superview.bounds.size.width;
  //  contentSize.height = self.affiliationListTableView.superview.bounds.size.height;
    self.affiliationListTableView.contentSize = contentSize;


}

我注意到contentSize在旋转方面有所不同。这是苹果方面的错误吗?如果我们使用的是UITableViewController而不是UIViewController,则不会发生这种情况。但是要求不允许我使用UITableViewController

view on portrait initially

view after rotation

请提供任何建议/想法

0 个答案:

没有答案