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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T03:04:41+00:00 2026-05-30T03:04:41+00:00

I have a grouped UITableView with 3 sections: 2 of the 3 are constants

  • 0

I have a grouped UITableView with 3 sections: 2 of the 3 are constants (each with only one cell that doesn’t change) and the first section which you can add or remove from cells. everything works perfectly besides when deleting cells from this section: once i deleted the last cell, this cell disappears (as expected) but then the other sections are not functional, meaning, i cant click on them (they both load another view). if i load the app when the first section is empty in the first place, everything is fine. this thing happens only after deleting the last cell in this section. i tried to put logs everywhere in the code and everything looks ok.

Would appreciate any suggestion.

Here is some code that may be relevant. happy to provide more if needed:

- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath
{
  if (indexPath.section == 0) {
    return YES;
 } else {
    return NO;
 }
}


- (void)tableView:(UITableView *)aTableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {

[tblSimpleTable beginUpdates];

if (editingStyle == UITableViewCellEditingStyleDelete) {

     NSMutableArray * section = [listOfItems objectAtIndex:indexPath.section];    
    [section removeObjectAtIndex:indexPath.row];

    //UPDATING USERS DEFAULTS
    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];            
    [defaults setObject:section forKey:@"listOfAccessNumbers"];

    [tblSimpleTable deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationRight];
    [tblSimpleTable reloadData];


    }


}     
else if (editingStyle == UITableViewCellEditingStyleInsert) {

...

}

[tblSimpleTable endUpdates];

}


- (void)setEditing:(BOOL)editing animated:(BOOL)animated {

NSLog(@"****************** entering setEditing");

[super setEditing:editing animated:animated];
[tblSimpleTable setEditing:editing animated:YES];
if (editing) {
     editButton.enabled = NO;
} else {
    editButton.enabled = YES;
}
}

UPDATE: adding more methods:

 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

NSLog(@"****************** entering cellForRowAtIndexPath");

static NSString *CellIdentifier = @"Cell";

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {

    cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:CellIdentifier]; //try here diff styles
}


NSArray *array = [[NSArray alloc] init];
array = [listOfItems objectAtIndex:indexPath.section];
NSString *cellValue = [array objectAtIndex:indexPath.row];
cell.textLabel.text = cellValue;
cell.textLabel.font = [UIFont systemFontOfSize:14];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
cell.textLabel.textColor = [UIColor colorWithRed:.196 green:0.3098 blue:0.52 alpha:1.0];

if (sectionIndicator == YES){

    if (indexPath.section == 0) {
        cell.accessoryType = UITableViewCellAccessoryNone;
    }
    else if (indexPath.section == 1) {
        cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    }

}
else
{
    if (indexPath.section == 0) {
        cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    }
    else if (indexPath.section == 1) {
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
    }
}


return cell;
}




 - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {

return [listOfItems count];    
 }



 - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {

return [[listOfItems objectAtIndex:section] count];
 }
  • 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-05-30T03:04:42+00:00Added an answer on May 30, 2026 at 3:04 am

    I think I may know what’s going on, so I’m going to post it as an answer.

    I just noticed that you are calling for listOfItems to get the temp array which you remove the item from. I also see you are then updating an object in the NSUserDefaults. After this is done, is listOfItems also updated? If it isn’t, that is where you problem lies. It will continue to hold all the same information as before, thus appearing as if there’s no update occurring. I hope this is the case, because it will make for a very easy fix on your part. If it isn’t, seeing your dataSource methods might be necessary to see where the problem might lie.

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

Sidebar

Related Questions

I have one problem with two sections in UITableview grouped style. First section having
I have a grouped style UITableView. It have only one section & the section
I have a grouped table with 3 sections, each section with a title. The
I have a grouped UITableView that has 3 sections. I would like to show
I have a UITableView that is grouped into sections and has a number of
I have a grouped tableview that is populated with XML data in one section.
I have a grouped uitableview which has several sections. The sections are showing up
I have an UITableView grouped. I inserted UISegmentedButton in first section and second section.
I have a grouped UITableView with many sections, however, I want to iterate through
I have a grouped UITableView where not all sections may be displayed at once,

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.