Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8347745
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T07:27:41+00:00 2026-06-09T07:27:41+00:00

I want to add a section header to my tableview when it is in

  • 0

I want to add a section header to my tableview when it is in editing mode. Basically I would just want it to be a part of the datasource to have the same look as the rest of the table (see below image for wanted result). But inserting an object (“Add Contact”) to the data source leads to alot of micro management when switching in and out from editing mode and it’s actually not part of the data source it is more as a header.

I tried using the following code snippet to achieve the same effect but it didn’t turn out right (just added the Add Contact text to sit on top of the section, but not part of it as a grouped table cell).

Anyone have any clues on what I’m missing?

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
    UIView *headerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, tableView.bounds.size.width, 30)];

    if (section == 1) {

        UITableViewCell *addContactCell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:nil];

        addContactCell.textLabel.text = @"Add Contact";
        addContactCell.textLabel.opaque = NO;

        return addContactCell;

    } else {

        return nil;
    }

}

enter image description here

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T07:27:43+00:00Added an answer on June 9, 2026 at 7:27 am

    You don’t need to add the ‘Add Contact’ row to the datasource. You just have to lie in your numberOfRowsInSection, and in cellForIndexPath: methods.

    tableView:numberOfRowsInSection: needs to return the number of rows + 1.

    tableView:cellForIndexPath: returns your insert cell if the row number is 0, and otherwise returns the cell for the data for indexPath.row – 1.

    You’d have to have a little extra stuff in didSelect etc, but there shouldn’t be a lot of micromanagement involved.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to create a tableview like this. All sections have custom section header
I have a edit in place section to which I want to add a
I have 3 tables: Book, Section and Content. I want to add many-to-many relation
I want to put an info light button in a section header - (CGFloat)tableView:(UITableView
I want to add a table header (not section headers) like in the contacts
I want to add a custom configuration section in my app.config file. Is there
I want to show multiple detail section in my jasper report. How to add
I want add label to every row in tableview at right side of the
So I have a listview and I want to add different sections to it.
I want to add StyleSheets programmatically in the head section but one of the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.