【问题标题】:UITableView inside UIPageViewController EdgeInset issueUIPageViewController EdgeInset 内的 UITableView 问题
【发布时间】:2014-07-19 12:20:55
【问题描述】:

我有一个包含UIViewController,它符合UIPageViewControllerDataSource,并且有一个UIPageViewController 作为childViewController。然后容器将其他ViewControllers 作为其数据源适当地加载到 PageView 中。一切正常,除了一个小警告。容器加载的 ViewController 之一是 UITableViewController。这个UITableView 似乎没有设置insets。我不知道为什么除了 PVC 没有从容器中获得正确的插图之外的问题。 UIPageViewController 肯定有 automaticallyAdjustsScrollViewInsets,但是,即使我将其设置为 false 并在情节提要中手动执行,它仍然不起作用。

我在这个项目中使用 Swift 并且 AutoLayout 已打开,但在 UITableViewController 的 .xib 中没有。

任何帮助将不胜感激,
迈克

【问题讨论】:

  • 对我有用的是为受影响的组件设置 translatesAutoresizingMaskIntoConstraints = true。

标签: ios objective-c swift uitableview uipageviewcontroller


【解决方案1】:

这是UITableViewController 的一个已知“功能”。它抓取整个根视图,以便忽略插入。

解决方案是使用UIViewController,它有一个表视图并符合其数据源和委托。

【讨论】:

  • 实际上我最初是从一个 UIViewController 和一个 UITableView 开始的,但是当它不起作用时,我将它切换到 UITableViewController 但遗憾的是它仍然没有修复它。
  • 你设置了插图吗?
  • 在带有 TableView 的 ViewController 上?我会做的,但我可以再次更改它,以测试它。
  • 是的,它起作用了,在情节提要中手动将插图设置为 64,并将 UITableView 嵌套在 UIViewController 中。必须在它不起作用之前在某个地方覆盖它。谢谢。
猜你喜欢
  • 2015-04-10
  • 2013-10-05
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-11-22
  • 2016-06-02
  • 2013-08-01
相关资源
最近更新 更多