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 8454287
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T11:59:10+00:00 2026-06-10T11:59:10+00:00

I have a UITableView with three sections, the second section has the table that

  • 0

I have a UITableView with three sections, the second section has the table that shows insertion and deletion indicators in editing mode. I’m adding a cell for the insertion row in cellForRowAtIndexPath: when editing is YES. Also, when the table goes in to editing mode I reduce the number of sections so the third section doesn’t show (it has a button in it that I want to hide when in editing mode). Unless I call [self.tableView reloadData] in setEditing I don’t see the insertion row, but when I do call it there is no animation. What am I doing wrong?

- (void)setEditing:(BOOL)flag animated:(BOOL)animated

{
  [super setEditing:flag animated:YES];
  [self.tableView setEditing:flag animated:YES];
  //unless i add [self.tableView reloadData] i don't see the + row, but then there is no animation
  [self.tableView reloadData];

To determine number of sections I am doing this

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return self.editing ? 2 : 3;
}

To add the insertion row I am doing this in cellForRowAtIndexPath

 if (indexPath.row == [[[self recipe] tasks] count])
 {
    cell.textLabel.text = @"Add task...";
    cell.detailTextLabel.text = @"";

Any help greatly appreciated. I’m embarrassed to say how much time I’ve wasted on this!

  • 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-10T11:59:12+00:00Added an answer on June 10, 2026 at 11:59 am

    You need to use UITableView‘s update methods. Check out Apple’s comprehensive guide on the subject for more details, but this code snippet should give you an idea. Note that you should do the opposite when your table view leaves editing mode.

    NSIndexPath *pathToAdd = [NSIndexPath indexPathForRow:self.recipe.tasks.count section:SECTION_NEEDING_ONE_MORE_ROW];
    NSIndexSet *sectionsToDelete = [NSIndexSet indexSetWithIndex:SECTION_TO_DELETE];
    [self.tableView beginUpdates];
    [self.tableView insertRowsAtIndexPaths:@[ pathToAdd ] withRowAnimation:UITableViewRowAnimationAutomatic];
    [self.tableView deleteSections:sectionsToDelete withRowAnimation:UITableViewRowAnimationAutomatic];
    [self.tableView endUpdates];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have three sections in my hypothetical UITableView. I'd like one section that is
I have an UITableView and it has 18 sections, in each section there is
I have a UITableViewController which has two sections. The first section shows a single
I have a UITableView that has 3 sections. My individual cells vary in height
I have a UITableView with multiple sections. Each section has a section header (a
I have my UITableView data organized such that the sections of the table are
I have a tableview with four sections first section has 7 rows in that
I have a UITableView on a UIViewController. And this table has say 5 visible
I have a TableViewController that is using a grouped Style and has two(2) sections.
I have a UITableView with 2 sections. The section 0 contains a list of

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.