設置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;
}

上面的代碼是從帶二個開始顯示的,第一組沒有spa

下面的代碼是從頭開始顯示的code

- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section{
    return _dictData.allKeys[section];
}
相關文章
相關標籤/搜索