Effective solution to UITableHeaderView coverage of Cell content

In project development, the problem of tableHeaderView covering Cell content is encountered,

error code
UIView *headerView = [[UIView alloc] init]; headerView.backgroundColor [UIColor = clearColor] tableHeaderView self.tableView.tableHeaderView = headerView; / / set; / / add. / / headerView.frame Technology... Set frame = CGRectMake (0, 0, kScreenW, 100);
Effective solution to UITableHeaderView coverage of Cell content
screenshot.Png
Solve the problem
UIView *headerView = [[UIView alloc] = [UIColor init]; headerView.backgroundColor clearColor]; / / add. / / headerView.frame Technology... Set frame = CGRectMake (0, 0, kScreenW, 100); / / set tableHeaderView self.tableView.tableHeaderView = headerView;

The key here is to set up frame first, set view’s frame, and then set tableHeaderView.

Because the real tableHeaderView of frame is determined by setting tableHeaderView.