【问题标题】:Navigation bar with "Prefers Large Titles" and embedded PageViewController not collapsing带有“首选大标题”和嵌入式 PageViewController 的导航栏不折叠
【发布时间】:2019-06-29 14:49:04
【问题描述】:

我已经设置了一个“UIViewController”(嵌入在“UINavigationController”中),并且“UIViewController”有一个“ContainerView”和一个“UIPageViewController”。

在“UIPageViewController”中有几个带有“UITableViews”的子视图。

现在的问题是,如果 TableView(嵌入在 ContainerView 中)滚动,启用“首选大标题”的“UINavigationBar”不会折叠。

我认为这是“UIPageViewController”的问题。大小和ContainerView一样。

我该如何解决这个问题?

【问题讨论】:

标签: ios xcode ipad uinavigationbar uipageviewcontroller


【解决方案1】:

仅当控制器的“根”视图是表格视图或滚动视图时,自动折叠大标题栏才有效。

由于您的 tableview 嵌入在 containerView 中,因此标题栏不知道该 containerView 内部发生了什么。

顺便说一句,我想说你必须使用委托/协议模式来让你的嵌入式 tableview(控制器)告诉包含视图控制器的 containerView 更改标题栏的大小。

【讨论】:

  • 我明白了。您认为可以将“ContainerView”用于“UIScrollView”来解决这个问题吗?
  • 如果您将 ContainerView 替换为 ScrollView,然后尝试添加 PageViewController(使用表格视图)作为滚动视图的子视图,我希望您会遇到额外的导航问题和冲突的滚动操作问题。在不了解您的完整 UI/流程的情况下很难说。
猜你喜欢
  • 2018-03-04
  • 1970-01-01
  • 1970-01-01
  • 2013-12-17
  • 1970-01-01
  • 2015-02-05
  • 2014-12-19
  • 1970-01-01
  • 2017-06-06
相关资源
最近更新 更多