如何在heightForRowAtIndexPath方法中确定单元格的reuseIdentifier?

时间:2015-08-23 17:40:48

标签: ios uitableview cell heightforrowatindexpath

我有两种不同类型的细胞。我需要在方法中为每个分配不同的大小:

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

我如何确定细胞类型?也许得到它的reuseIdentifier等。

更新 我试试这个时

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    NSLog(@"%@", [self.tableView cellForRowAtIndexPath:indexPath]);
}

我收到一个例外 enter image description here

1 个答案:

答案 0 :(得分:1)

您需要确定从_messages数组中获取的对象中的每个单元格。

id object = _messages[indexPath.row];