//获取约束的高度
CGFloat height = [tableHeaderView systemLayoutSizeFittingSize:UILayoutFittingCompressedSize].height;
//修改headView的frame
CGRect frame = tableHeaderView.frame;
frame.size.height = height;
tableHeaderView.frame = frame;
//刷新tableHeaderView
self.tableView.tableHeaderView = tableHeaderView;
网友评论