UITableViewCell

1.定义每个UITableView中的cell的行高

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath

{

    // indexPath.section,根据分组进行更精确的配置

    return 90.0;

}


2.设置UITableView每个分组的Header的Title

- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section{

    return [_arrayType objectAtIndex:section];

    

}


3.设置UITableView分组Header的高

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

    return 30.0;

}


4.设置UITableView自定义的Header

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


    // 自定义的Header

    ViewForCellHeader *headerView=[[[ViewForCellHeader alloc] init] autorelease];

    headerView.strSectionName=[_arrayType objectAtIndex:section];

    return  [headerView view];

}


注意:2与4是互斥的。

同理原理,我们分别也对Footer进行设置。

5.设置UITableView每个分组的Footer的Title

- (NSString *)tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section{

    return [_arrayType objectAtIndex:section];

    

}


6.设置UITableView分组Footer的高

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

    // indexPath.section,根据分组进行更精确的配置

    return 30.0;

}


7.设置UITableView自定义的Footer

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

    // 自定义的Footer

    ViewForCellHeader *headerView=[[[ViewForCellHeader alloc] init] autorelease];

    headerView.strSectionName=[_arrayType objectAtIndex:section];

    return  [headerView view];

}


8.设置UITableView每个分组的Footer的Title

- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section{

    return [_arrayType objectAtIndex:section];

    

}


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值