gpt4 book ai didi

ios - UITableView 嵌套在没有边距的 UICollectionViewCell 中

转载 作者:行者123 更新时间:2023-11-28 14:10:05 24 4
gpt4 key购买 nike

在我当前的项目中,我使用嵌套在每个 UICollectionViewCell 中的 UITableView。在 UITableView 中,我有许多由边框分隔的自定义 UITableViewCells,如屏幕截图所示。

我希望每个边框 tp 从左到右拉伸(stretch)整个屏幕长度,但正如您在第一张图片中看到的那样,每个边框都在屏幕外缘附近停止。

在第二个屏幕截图中,我在 UITableView 的整个边缘周围放置了一个边框,以确认确实是 UITableView 的大小导致了这个问题。

在 Storyboard 中,UITableView 的上、下、左、右约束设置为与 UICollectionViewCell 相同。

在UICollectionViewCell的属性中,我将固定边距全部设置为0,并且取消了“安全区域相对边距”。

此外,在初始化 UICollectionViewCell 时,我尝试过:

self.layoutMargins = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)

感谢您提供的任何帮助。

First Screenshot

Second Screenshot

最佳答案

我是个白痴...忘记了 contentViews 是一回事。

使用:self.contentView.layoutMargins = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0) 一切都很美好。

关于ios - UITableView 嵌套在没有边距的 UICollectionViewCell 中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52668360/

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