iphone - 如何从 iPhone 中特定行的 UITableView 中删除 Header?

标签 iphone ios uitableview header

我有一个 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/

相关文章:

ios - 如何在 Swift 中以编程方式设置 UITableView 单元格高度?

xcode - 无法使用swift更改uitableviewcell中的字体

ios - 使用 UISearchController 搜索 TableView

iphone - 每次通话结束后在 iOS 中调用应用程序

iphone - 有哪些 iPhone 推送通知服务? (托管服务,而不是 APNS)

iphone - 如何以编程方式在 iphone 中下载带有 youtube url 的 youtube 视频

iphone - 在 Iphone +[UIActivityIndi​​catorView _loadResourcesForStyle :]? 中显示泄漏

ios - 使 UICollectionView 连续滚动

ios - 未在 ios 目录中创建 Flutter Podfile 和 Pods 文件夹

iphone - 这是转到下一个 UITextField (使用 textFieldShouldReturn)的一种黑客方式吗?