简体   繁体   English

如何使用带有嵌入式表的两个容器视图进行布局

[英]How to layout with two container views with embedded tables

I am trying to layout the following UI View 我正在尝试布局以下UI视图

The Main UI View has two Container Views. 主UI视图有两个容器视图。 The top container view embeds a static table controller. 顶部容器视图嵌入了一个静态表控制器。 The bottom container view embeds another table controller which I want to be dynamic. 底部容器视图嵌入了另一个我想动态化的表控制器。

How can I set the layout so that the height of the top container view is equal to that of the top table, and the bottom container view gets the rest? 如何设置布局,以使顶部容器视图的高度等于顶部表的高度,而底部容器视图的高度得到其余部分?

Right now height is ambiguous for the container views. 现在,对于容器视图,高度是不明确的。

Constraint your top table view's height to some fixed value (it doesn't matter what). 将顶视图的高度限制为某个固定值(无关紧要)。

Make an outlet of that height constraint. 设置该高度限制的出口。

In your view controller, do this: 在您的视图控制器中,执行以下操作:

heightConstraint.constant = tableView.contentSize.height

this way bottom view will adjust accordingly. 这样,底视图将相应调整。

Make sure to disable bouncing in the top table view. 确保在顶表视图中禁用跳动。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在嵌入两个独立容器控制器中的视图之间实现委派 - Implementing delegation between views embedded in two separate container controllers 如何在两个容器视图中处理两个集合视图 - How to handle two collection views inside two container views Xcode 5自动布局-嵌入式表 - Xcode 5 Auto Layout - Embedded Tables 使用嵌入式视图了解自动布局生命周期和顺序 - Understanding Auto Layout lifecycle and sequence with embedded views 将数据传递给嵌入在容器视图中的视图控制器 - Passing Data to view controllers that are embedded in container views 如何管理自动布局中两个视图之间的间隙 - How to manage the gap between two views in auto layout 如何在一个视图控制器中将xib加载到两个容器视图中 - How to load xib into two Container Views within one view controller SwiftUI中两个嵌入视图之间的过渡效果 - Transition Effect Between Two Embedded Views in SwiftUI 在故事板中,嵌入式视图控制器不再与其容器视图大小相同 - In storyboard, embedded view controllers no longer same size as their container views iOS:情节提要中的Scrollview无法与嵌入式容器视图一起滚动 - iOS: Scrollview in storyboard won't scroll with embedded container views
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM