2011-10-17 66 views
0

我有一个与CustomCell的TableView。我的CustomCell我有一些标签的和一个按钮,当我点击按钮的一些标签将得到hide.Here来我的问题,现在我需要调整我的UITableViewCell基于CustomCell height.I知道使用我如何根据CustomCell的高度来调整UITableViewCell的大小?

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

我可以调整我的UITableViewCell.But我怎么能根据我的自定义单元格height.I不想使用任何计时器方法调整。如果有任何人知道,请帮助我..

回答

2

这是我做的调整的TableCell高度:

我重拍细胞在需要的索引路径,并根据其调节高度。

- (float) tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
    CustomCell *cell = (CustomCell*)[self tableView:tableView cellForRowAtIndexPath:indexPath]; 

    return cell.contentView.frame.size.height; 
} 
+0

,但我需要调整我的tableView细胞当我点击按钮的CustomCell – Hardy

+0

内此刻您点击按钮,你需要做一个[yourTableView reloadData],一切都会很好。 –

+0

但是我怎样才能从CustomCell文件中调用它? 对不起,我是新的目标c。 – Hardy

相关问题