【问题标题】:TableView in UIViewController moves to sides inside the windowUIViewController 中的 TableView 移动到窗口内的两侧
【发布时间】:2013-01-11 14:11:42
【问题描述】:

我刚刚通过情节提要在UIViewController 中添加了TableView 并在NavigationController 中嵌入了ViewController。我实现了委托和源方法,一切正常,除非我第一次以 landscape 模式加载视图然后将其更改为纵向模式。 TableView 可以移动到窗外的侧面并保持不动,但不会粘在边缘。

PS:这是专为在 iPad 上使用而设计的。

编辑:添加了另一个 ss:http://d.pr/i/vs5d

【问题讨论】:

  • 它可能与您使用自动布局或支柱和弹簧的方式有关。

标签: ios objective-c uitableview uiviewcontroller autoresize


【解决方案1】:

找到了答案;方向改变后需要重新加载表格视图。我猜这是横向->纵向方向更改后发生的自动布局错误。

-(void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
{
    [self.tableView beginUpdates];
    [self.tableView endUpdates];
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-10-03
    • 2014-10-03
    • 2021-11-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-03-06
    • 1970-01-01
    相关资源
    最近更新 更多