码迷,mamicode.com
首页 > 其他好文 > 详细

UITableViewStyleGrouped 类型 tableView sectionHeader 高度问题

时间:2019-11-02 17:38:18      阅读:118      评论:0      收藏:0      [点我收藏+]

标签:记录   uitable   turn   代码   好的   并且   elf   float   init   

UITableViewStyleGrouped 类型的 tableView 在适配的时候出现很大的问题。记录一下

按照之前的方法,只需要执行以下的代码就能够很好的解决 section == 0 的时候,sectionHeader 的高度问题以及 section 间距的问题


tableView.delegate = self;
tableView.dataSource = self;
tableView.sectionFooterHeight = 0.01f;
tableView.tableFooterView = [UIView new];

 

通过以下的方法能够良好的解决 sectionHeader 的高度问题,并且是兼容 iOS 10 以及其他版本的



- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { UIView *headerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, ScreenWidth, 10.0f)]; return headerView; } - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{ if (section == 0) { return 0.01; } return 10; } - (CGFloat)tableView:(UITableView*)tableView heightForFooterInSection:(NSInteger)section { return 0.001; }

 

UITableViewStyleGrouped 类型 tableView sectionHeader 高度问题

标签:记录   uitable   turn   代码   好的   并且   elf   float   init   

原文地址:https://www.cnblogs.com/henusyj-1314/p/11782978.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!