ios - 如果 numberOfRowsInSection 为零,是否自动显示 tableFooterView?

标签 ios objective-c cocoa-touch

即:

if ([self.tableView numberOfRowsInSection:0] == 0) {
    self.tableView.tableFooterView.hidden = NO;
} else {
    self.tableView.tableFooterView.hidden = YES;
}

但我希望它能自动更新。

最佳答案

你可以实现这个功能:

-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
{
    if ([tableView numberOfRowsInSection:section] == 0) return ***height***;
    else return 0;
}

关于ios - 如果 numberOfRowsInSection 为零,是否自动显示 tableFooterView?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17314321/

相关文章:

iphone - 为什么设置 UISegmenteControl 或 UIBarButtonItem 的tintColor 会禁用按钮按下动画?

ios - 验证UITextField不包含字母

iphone - UITabBarController 自定义

iphone - UIView 与许多 TableView

ios - 检查 NSArray 是否排序

objective-c - UINavigationController 后退按钮按下并 viewWillDisappear

ios - RealmSwift 列表<String> EXC_BAD_ACCESS

objective-c - 不使用 MKReverseGeocoder 的反向地理编码

iOS:检测触地、转场、触地

iphone - 使用 unicode 的分数的 NSString 表示