0

我創建了UITableView使用Interface Builder我有一個頁腳空間那裏,我設計了我的自定義視圖作爲部分頁腳。但我希望最初隱藏部分頁腳,並且只在服務調用後加載它。UITableView部分頁腳不隱藏

我已經試過

self.tableview.tablefooterview.hidden = YES 
self.tableview.sectionFooterHeight = 0.0f 

我還建立在委託方法的高度,但表尾的觀點並沒有隱藏在所有。我如何隱藏表格頁腳視圖。

回答

0

請試試這個代碼

- (void)viewDidLoad 
{ 
    self.tableview.sectionHeaderHeight = 0.0; 
    self.tableview.sectionFooterHeight = 0.0; 
    self.tableview.tableHeaderView=[[UIView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, self.tableview.bounds.size.width, 0.01f)]; 
    self.tableview.tableFooterView=[[UIView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, self.tableview.bounds.size.width, 0.01f)]; 
} 
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section { 
    return 0; 
} 
0

使用UITableView委託方法: -

- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section { 

    return 0; 
} 
0

請儘量部分頁腳值設置爲大於0(零)。我試圖將它設置爲0.000001,它的工作原理。

- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section { 

return 0.000001; 
} 
1

檢查此鏈接瞭解如何Hide footer view in UITableView

- (UIView*)tableView:(UITableView*)tableView viewForFooterInSection:(NSInteger)section 
{ 
    return [[UIView alloc] initWithFrame:CGRectZero]; 
}