简体   繁体   English

带有动态表视图的ioS Scroll View

[英]ioS Scroll View with dynamic table View

I want to create a “ViewController” Scene with a “Scroll View” and in this view there should be a “Table View” at the top, 1 “segmented Control and 2 tables at the bottom. 我想创建一个带有“滚动视图”的“ ViewController”场景,在此视图中,顶部应有一个“表视图”,底部应有1个“分段控件”,而2个表。 The “Segmented Control” should switch the bottom table views. “分段控件”应切换底部的表格视图。 Like in this picture: 就像这张照片:

在此处输入图片说明

My problem with this scene is that the table should have a dynamic height. 我在此场景中遇到的问题是桌子应该具有动态高度。

I need the bar over the complete page and not in the individual tables. 我需要整个页面上而不是单个表格中的栏。 Is it possible to create such a scene and if yes, which constraints do I have to set? 是否可以创建这样的场景?如果可以,我必须设置哪些约束? I hope you can help me! 我希望你能帮帮我! Thanks a bunch! 谢谢一群!

tableView inside scrollView is a disastrous idea, because scrollView内部的tableView是一个灾难性的想法,因为

  1. tableView itself have its own scrollView . tableView本身具有自己的scrollView

  2. Scrolling will be very sticky and it may freeze UI. 滚动将非常棘手,并且可能会冻结UI。

The best solution comes on my mind is to take single tableView and manage multiple sections . 我想到的最好的解决方案是采用单个tableView并管理多个sections

The Green portion will be your first section. 绿色部分将是您的第一部分。

Segment control will be second. 段控制将是第二位。

and blue section will be third. 蓝色部分将排名第三。

In this way you can achieve both dynamic height as well as single scroll bar condition. 这样,您既可以实现动态高度,又可以实现单个滚动条条件。

Let me know if it works. 让我知道它是否有效。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM