简体   繁体   中英

How can I remove space between tableview header and first cell?

How can I remove the space in the UITableView header an the content of the table?

I have tried the following but I still have space after the tableview header

tableView.contentOffset = CGPointZero
self.automaticallyAdjustsScrollViewInsets = false
tableView.contentInset = UIEdgeInsetsMake(-20, 0, -20, 0)

you can use this code for header remove and make less space between first cell,

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
 {
    return 0.005f;// set this according to that you want...
 }

and you can also set footer as follows..

 - (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
{
  return 3.5f;// also set this one as you want ...
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM