Ios7 iOS 7第1节中标题部分标签偏移的分组表视图

Ios7 iOS 7第1节中标题部分标签偏移的分组表视图,ios7,uitableview,Ios7,Uitableview,我已经实现了一个自定义viewForHeaderInSection,如下所示: - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { CGRect sectionFrame = CGRectMake(0, 0, tableView.bounds.size.width, 30.0f); float xInset = 16.0; RTUTableHe

我已经实现了一个自定义viewForHeaderInSection,如下所示:

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
    CGRect sectionFrame = CGRectMake(0, 0, tableView.bounds.size.width, 30.0f);
    float xInset = 16.0;
    RTUTableHeaderView
            *headerView =
            [[RTUTableHeaderView alloc] initWithFrame:sectionFrame
                                   andBackgroundColor:[UIColor clearColor]
                                            FontColor:[RTUColorHelper kSettingsTableCellFontColor]
                                          andFontSize:18.f
                                       withLabelFrame:CGRectMake(xInset, 10.f, sectionFrame.size.width - xInset, 20)];
    headerView.label.text = [self tableView:tableView titleForHeaderInSection:section];
    return headerView;

}
这会将标签向下推10分,使其更靠近相关部分。在iOS6中,它看起来不错,但对于iOS7,第一节标题中的标签比其他部分的标签高出约10分。如果去掉10磅的偏移量,第一个部分的标签位于headerView的顶部,而其他部分则垂直居中于标题框架中

如果第0节是一个bug,我可以直接修改它的值,但显然我不想这样做,我想检查一下我是否忘记了其他的东西或做了错误的事情


节标题的高度都相同,heightForRowAtIndexPath返回44.f

,因此我解决此问题的唯一方法是在第一个节标题中添加偏移量:

    if(section==0){
        CGRect labelFrame = headerView.label.frame;
        labelFrame.origin.y+=15.f;
        [headerView.label setFrame:labelFrame];
    }

如果有谁有更好的主意,我很乐意听

那么实际的问题是什么…?哈,我的错。。。我写了一封信