// 设置分割线:距离两边间距10
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{
[cell setLayoutMargins:UIEdgeInsetsMake(0, 10, 0, 10)];
[cell setSeparatorInset:UIEdgeInsetsMake(0,10, 0, 10)];
}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
if (section == 0) {
return 0.00001; // 把header高度设置很小,可以看成header的高度等于0
}
return 20;
}
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
{
// 如果设置了section的header高度,不设置footer高度,footer默认等于header高度
return 0.00001; // 把footer高度设置很小,可以看成footer的高度等于0
}
// UITableView的style为UITableViewStyleGrouped
- (UITableView *)tableView
{
if (!_tableView) {
_tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, ICAN_WIDTH, ICAN_HEIGHT - ICAN_NAV_BAR_HEIGHT) style:UITableViewStyleGrouped];
_tableView.rowHeight = 50;
_tableView.delegate = self;
_tableView.dataSource = self;
_tableView.tableFooterView = [[UIView alloc] init];
_tableView.layoutMargins = UIEdgeInsetsMake(0, 10, 0, 10);
_tableView.separatorInset = UIEdgeInsetsMake(0, 10, 0, 10);
}
return _tableView;
}
UITableView去掉Grouped样式的第一组Header组头
最新推荐文章于 2018-07-11 13:54:27 发布