2011-10-17 65 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

相關問題