UITableViewStyleGrouped的间距问题

来源:互联网 发布:gta5 n卡优化 编辑:程序博客网 时间:2024/05/16 07:28

[UITableViewalloc]initWithFrame:CGRectMake(。。。。)style:UITableViewStyleGrouped];

UITableViewStyleGrouped,section的间距由footer和header组成,调整footer和header的大小就可以了。



-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{

    if (section == 0) {

        

    UIView *view = [[UIViewalloc]initWithFrame:CGRectMake(0, 0,SCREEN_W, 100)];

  //。。。。。。

    

    return view;

    }

    returnnil;

}


-(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{

    returnnil;

}


-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{

   

    return section == 0 ? 100 : 1;

    

}


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

    return 1;

}



0 0