设置tableView 的Section的title问题

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
    UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(15, 15, 300, 60)];
    titleLabel.text = _dictData.allKeys[section];
    NSLog(@"%@",titleLabel.text);
    titleLabel.textColor = [UIColor lightGrayColor];
    titleLabel.font = [UIFont systemFontOfSize:15];
    NSLog(@"%ld",section);
    return titleLabel;
}

上面的代码是从带二个开始显示的,第一组没有

下面的代码是从头开始显示的

- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section{
    return _dictData.allKeys[section];
}

 

posted @ 2015-11-21 11:35  破水杯  阅读(2162)  评论(0编辑  收藏  举报