[英]UITableView section footer not hiding
我使用Interface Builder
創建了一個UITableView
我有一個部分頁腳空間,我將自定義視圖設計為部分頁腳。 但我希望最初隱藏部分頁腳並僅在服務調用后加載它。
我努力了
self.tableview.tablefooterview.hidden = YES
self.tableview.sectionFooterHeight = 0.0f
我還在委托方法中設置了高度,但是表頁腳視圖根本沒有隱藏。 如何隱藏表格頁腳視圖。
檢查此鏈接以了解如何在UITableView中隱藏頁腳視圖
- (UIView*)tableView:(UITableView*)tableView viewForFooterInSection:(NSInteger)section
{
return [[UIView alloc] initWithFrame:CGRectZero];
}
使用UITableView
委托方法: -
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
return 0;
}
請嘗試將部分頁腳值設置為大於0(零)。 我試着把它設置為0.000001並且它有效。
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
return 0.000001;
}
請試試這段代碼
- (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;
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.