我有一个 tabelview
以朴素的风格。我必须从每一行添加标题。每个标题应该有不同的值。我将值分配给 NSMutableArray
中的标题. NSMutableArray
可能有来自 WebService
的空值.如果 NSMutableArray
中的值我需要隐藏或删除特定行的标题。这是我的桌面 View 设计,
Header(Data)
Name:iPhone
Company : Apple
Header(Data)
Name:iPod
Company : Apple
Header(Null) // I want to remove this header from the tableview
Name:iPad
Comapany : Apple
Header(Data)
Name:iMac
Comapany : Apple
当数据为 Null 时,如何删除特定的 header ?谁能帮帮我吗?谢谢。
最佳答案
你可以通过两种方式:-
1)设置header view的Height为0为null值
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
return 0.0;
}
2) 你必须从
viewForHeaderInSection
返回 nil方法和调用 [myTableView reloadData]
关于iphone - 如何从 iPhone 中特定行的 UITableView 中删除 Header?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8850402/