如上图,按照以前的添加方式header上面会有空白。
最新方法设置headerTop间距为0,就正常了
self.tableView.sectionHeaderTopPadding = 0;
添加headerView方式还是一样的只需设置一下sectionHeaderTopPadding高度就可以了
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
return 5;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
return 5;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"tableViewCell" forIndexPath:indexPath];
cell.backgroundColor = [UIColor redColor];
return cell;
}
- (CGFloat)tableView:(UITableView *)tableView heigh