gpt4 book ai didi

iPhone:更改来自 NIB 的 UITableViewCell 的高度

转载 作者:行者123 更新时间:2023-12-03 20:58:51 27 4
gpt4 key购买 nike

我有一个自定义 UITableViewCells 的 UITableView,如下所示:

[ CELL 0
[ description ]
[ dynamic content type 1 ]
[ dynamic content type 2 ]
[ dynamic content type 3 ]
]
[ CELL 1
[ description ]
[ dynamic content type 1 ]
[ dynamic content type 3 ]
]
[ CELL 2
[ description ]
[ dynamic content type 2 ]
]
[ ... and so on ... ]

由于 [description] 部分已经相当复杂,我决定使用 Interface Builder 来设计它,并使用 [cell addSubview: 以编程方式在 cellForRowAtIndexPath 中添加[动态内容]。 ..]。我现在的问题是,我在 Interface Builder 中为自定义 UITableViewCell 设置了默认高度,但是当我添加[动态内容](范围可能在 0..3 之间)时,我有不同高度的不同单元格。

一件事当然是计算总高度并更改 heightForRowAtIndexPath 中的返回值,但是如何更改实际 cell 的高度值(这是从具有固定高度的 nib 文件加载)?

最佳答案

为什么不在 cellForRowAtIndexPath 中更新单元格的边界(您已经在其中添加了动态内容)?

关于iPhone:更改来自 NIB 的 UITableViewCell 的高度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2744235/

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