TableView section 头标题默认大写的解决

2017-06-13  本文已影响258人  test158888

TableView section 头标题默认大写的解决


Simulator Screen Shot 2017年6月13日 16.21.40.png
-(NSString*)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section{
    
    JYSetterGroup *group = self.groups[section];
    return group.headTitle;
    
}

增加方法-(UIView *) tableView:(UITableView *)tableView viewForHeaderInSection:

-(UIView *) tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
   
    UILabel *headerLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, tableView.bounds.size.width, 20)];
//注意这里调整不了高度
    
    if (section == 0) {
        headerLabel.text = @"小写a";
    }
    else {
        headerLabel.text = @"headBBBBBBB";
    }

    return headerLabel;
}

-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
    return 10;

}
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    return 27;}

上一篇 下一篇

猜你喜欢

热点阅读