gpt4 book ai didi

ios - 当 tableview 内容大小增加时,scrollview 中的 tableview 然后 tableview 正下方的 textview 上升到 tableview

转载 作者:行者123 更新时间:2023-11-28 15:10:16 26 4
gpt4 key购买 nike

我有 Viewcontroller,我在其中设置了 ScrollView 。在 scrollview 中,我有一个 tableview,它位于 Container 中,就在容器下方,当我将 tableview 框架大小设置为等于内容大小和 tableview 滚动属性 false 时,我有一个 textview 和其他一些 UIView,这样当内容大小增加时,只有 scrollview 滚动textview 上升到 tableview,我希望当 tableview 内容增加时,textview 也下降,父 View 框架大小随着内容大小增加和减少 this is when content size is small

this is when content size increase

最佳答案

这看起来像是 UICollectionViewController 的工作。如果你想看一看here

您可以更好地了解它们是什么以及如何使用它们。基本上你想把每个 UITableViews、UILabels 和 UIButtons 放在它自己的 collectionView 单元格中(需要安排按钮),然后带有按钮的单元格尝试使用带有图像的堆栈 View 。这将自动将不同的部分彼此分开。我知道包含 tableView 的 collectionViewCell 的想法可能看起来很奇怪但是 check this out

另一种解决方案是疯狂使用约束和自动布局。我不推荐这条路线,因为如果没有明确声明确切的布局,autoLayout 将自行做出决定。基本上,您将通过将 tableView 和标签固定到彼此以及它们所在的容器来设置约束。查看 Apple 文档 here

祝你好运,让我知道进展如何

关于ios - 当 tableview 内容大小增加时,scrollview 中的 tableview 然后 tableview 正下方的 textview 上升到 tableview,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47774773/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com