Ios UITableViewCell-仅第一个单元格没有节标题

Ios UITableViewCell-仅第一个单元格没有节标题,ios,objective-c,uitableview,Ios,Objective C,Uitableview,是否可以仅隐藏/删除第一个tableviewHeader 基本上,我想显示一个自定义单元格,它将被设计为一个报价-我不希望它有一个标题-我可以将此逻辑添加到我的HeightForHeaderSection方法中吗- -(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{ return 40; } 请检查以下内容: -(CGFloat)tableView:(UIT

是否可以仅隐藏/删除第一个tableviewHeader

基本上,我想显示一个自定义单元格,它将被设计为一个报价-我不希望它有一个标题-我可以将此逻辑添加到我的HeightForHeaderSection方法中吗-

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

    return 40;
}
请检查以下内容:

-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    if(section == 0)
    {
         return 0;
    }
    return 40;
}
或者可以实现viewForHeaderInSection

请检查以下内容:

-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    if(section == 0)
    {
         return 0;
    }
    return 40;
}
或者可以实现viewForHeaderInSection

试试这个:

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

    if(section == 0)
    {
       return 0;
     }
    return 40;
}
试试这个:

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

    if(section == 0)
    {
       return 0;
     }
    return 40;
}
是的,你应该:

-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    if (section == 0)
        return 0.0;
    else
        return 40;
}
另外,如果使用titleForHeaderInstruction:当section=0时,应返回nil。

是,应执行以下操作:

-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    if (section == 0)
        return 0.0;
    else
        return 40;
}

如果使用titleForHeaderInSection,则当section=0时应返回nil。

请尝试以下方法处理表视图的标题

- (CGFloat) tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    if (section == 0)
            return 1.0f;
    return 40.0f;
}

- (NSString*) tableView:(UITableView *) tableView titleForHeaderInSection:(NSInteger)section
{
    if (section == 0) {
        return nil;
    } else {
        // return some string here ...
    }
}

- (void) viewDidLoad
{
    [super viewDidLoad];

     self.tableView.contentInset = UIEdgeInsetsMake(-1.0f, 0.0f, 0.0f, 0.0);
}

对于表视图的标题,请尝试以下方法

- (CGFloat) tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    if (section == 0)
            return 1.0f;
    return 40.0f;
}

- (NSString*) tableView:(UITableView *) tableView titleForHeaderInSection:(NSInteger)section
{
    if (section == 0) {
        return nil;
    } else {
        // return some string here ...
    }
}

- (void) viewDidLoad
{
    [super viewDidLoad];

     self.tableView.contentInset = UIEdgeInsetsMake(-1.0f, 0.0f, 0.0f, 0.0);
}