如何获取tableView中的单元格对象:(UITableView *)tableView heightForRowAtIndexPath函数? [英] How to get the cell object in tableView:(UITableView *)tableView heightForRowAtIndexPath function?

查看:110
本文介绍了如何获取tableView中的单元格对象:(UITableView *)tableView heightForRowAtIndexPath函数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在返回heightForRowAtIndexPath时知道单元格的内容。在这个函数中如何获取单元格对象?

I wand to know the content of the cell when returning the heightForRowAtIndexPath. In this function how do I get the cell object?

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

}

如果我试试这个

 [tableView cellForRowAtIndexPath:indexPath]

它失败并在无限循环中消失。

it fails and goes off in an infinite loop.

任何想法?

推荐答案

调用self(委托)而不是tableView本身。

Call self (the delegate) rather than the tableView itself.

id cell = [self tableView:tableView cellForRowAtIndexPath:indexPath];

这篇关于如何获取tableView中的单元格对象:(UITableView *)tableView heightForRowAtIndexPath函数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆