gpt4 book ai didi

objective-c - 为每个 UITableViewCell 设置高度后获取 UITableViewCell 的高度

转载 作者:可可西里 更新时间:2023-11-01 05:04:05 26 4
gpt4 key购买 nike

我为每个 UITableViewCell 设置高度

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath

我需要获取每个 UITableViewCell 的高度

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath

因为我需要在不同的单元格中添加 subview 。

我试过使用cell.frame & cell.bounds & cell.contentView.frame,但是高度没有变了。

最佳答案

这可能为时已晚,但您可以使用委托(delegate)方法:

- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{
CGRect cellSize = cell.frame;
}

希望对任何人有帮助,如果我遗漏了什么,请告诉我。 :)

关于objective-c - 为每个 UITableViewCell 设置高度后获取 UITableViewCell 的高度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13968316/

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