2014-01-30 30 views
0

我已經使用了自定義的UITableView頁腳,它工作正常,但是當我更改heightForRowAtIndexPath中的單元格高度時,頁腳不見了。UITableView自定義頁腳消失

編輯:

我在這裏創建頁腳

-(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section 
{ 
    actStreamFooter = [[[NSBundle mainBundle]loadNibNamed:@"AcvitityStreamFooter" owner:self options:nil]objectAtIndex:0]; 
    footerHeight = actStreamFooter.frame.size.height; 

    UIButton *taptoLoad = [[UIButton alloc]initWithFrame:CGRectMake(0, 0, actStreamFooter.frame.size.width, actStreamFooter.frame.size.height)]; 
    [taptoLoad addTarget:self action:@selector(tapToLoad) forControlEvents:UIControlEventTouchUpInside]; 
    [actStreamFooter addSubview:taptoLoad]; 

    if (section == 1) { 
     return actStreamFooter; 
    } 
    else{ 
     return nil; 
    } 
} 

然後當我打電話

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

,因爲我需要更新該行,因爲我有每個單元內的擴展視圖。

更改高度後頁腳消失我試過[tableView reloadData]它的工作頁腳不消失,但有一個小故障閃爍時重新加載。我想刪除故障

+0

你究竟在哪裏設置頁腳? – mChopsey

+0

我編輯了這個問題。 – jyce1492

+0

你是否直接用你的代碼調用'heightForRowAtIndexPath'? – sha

回答

0

一個新的頁腳需要初始化並返回每個部分。 A UIView不能在視圖中多次出現。