2015-08-23 99 views
0

我有两种不同类型的细胞。我需要在方法中为它们中的每一个指定不同的尺寸:如何确定heightForRowAtIndexPath方法内的单元格的reuseIdentifier?

- (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

你不应该尝试使用的cellForRowAtIndexPath让细胞:方法heightForRowAtIndexPath:方法,因为它会造成死循环和异常。 – ArturOlszak

回答

1

您需要确定从对象你从_messages阵列得到每个单元。

id object = _messages[indexPath.row];

+0

我想知道如何获得reuseIdentifier,完全忘了我有另一种方法来确定单元格类型。谢谢! – Edward

相关问题