我可以强制UITableView隐藏空单元格之间的分隔符吗?
这个问题在这里已经有了答案:
你可以通过为tableview定义页脚来实现你想要的。 请参阅此答案以获取更多详细信息:消除UITableView下方的额外分隔符
对于iOS 7. *和iOS 6.1
  最简单的方法是设置tableFooterView属性: 
- (void)viewDidLoad 
{
    [super viewDidLoad];
    // This will remove extra separators from tableview
    self.tableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];
}
对于以前的版本
您可以将其添加到您的TableViewController(这将适用于任何数量的部分):
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
     // This will create a "invisible" footer
     return 0.01f;
 }
如果这还不够 ,添加以下代码太 :
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
{        
    return [UIView new];
    // If you are not using ARC:
    // return [[UIView new] autorelease];
}
对于Swift:
override func viewDidLoad() {
    super.viewDidLoad()
    tableView.tableFooterView = UIView()  // it's just 1 line, awesome!
}
上一篇: Can I force a UITableView to hide the separator between empty cells?
下一篇: How can I programmatically check whether a keyboard is present in iOS app?
