【发布时间】:2011-03-10 02:17:59
【问题描述】:
在heightForRowAtIndexPath 方法中,即给定indexPath,如何获得UITableViewCell?
(然后我可以访问我创建的内容视图来增加它们的高度)
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
// How to get the UITableViewCell associated with this indexPath?
}
谢谢
编辑:实际上真的有有效的方法来做到这一点吗?当我放一些NSLog 语句时,似乎heightForRowAtIndexPath 在调用cellForRowAtIndexPath 之前调用了几次(这是我在单元格中设置UILabels 的地方)?这种暗示我可能会尝试使用一种不起作用的技术,即我希望在heightForRowAtIndexPath 中访问每个单元格中已经创建的标签以获取它们的高度并将它们加在一起以获得整个单元格行高度,但是如果它们还没有设置好(在cellForRowAtIndexPath 内),那么我想我的方法真的行不通吗?
【问题讨论】:
标签: iphone ios uitableview heightforrowatindexpath