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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T04:22:37+00:00 2026-05-24T04:22:37+00:00

i have one section table which contain the section and i want to delete

  • 0

i have one section table which contain the section and i want to delete the perticular cell swap and delete this cell and remove that cell from table and also remove from the array.

and how to animate that when the delete the cell.

for that i code below but which is not working please help to do this.

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

    if (editingStyle == UITableViewCellEditingStyleDelete) {
        // Delete the row from the data source
        [self.reports removeObjectAtIndex:indexPath.row];
        [tbl reloadData];
            [tbl deleteRowsAtIndexPaths:[NSArray arrayWithObjects:indexPath] 
                                  withRowAnimation:UITableViewRowAnimationFade];    



    }   
}

After much more R&D then i build up new code and which is successfully Run

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


if (editingStyle == UITableViewCellEditingStyleDelete) {
    // Delete the row from the data source

    [[[self.reports objectAtIndex:indexPath.section] valueForKey:@"events"] removeObjectAtIndex:indexPath.row];
    [tbl deleteRowsAtIndexPaths:[NSArray arrayWithObject:[NSIndexPath indexPathForRow:indexPath.row inSection:indexPath.section]] withRowAnimation:UITableViewRowAnimationLeft];

[NSTimer scheduledTimerWithTimeInterval: 0.1 target: self selector: @selector(tableReload) userInfo: nil repeats: NO]; 
}

}

-(void)tableReload{
    [tbl reloadData];  }
  • 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-24T04:22:38+00:00Added an answer on May 24, 2026 at 4:22 am

    Firstly you should not Reload table before deleting row from table. Secondly, in your case you have multiple sections and multiple rows in that section, I guess. So, your

    [tbl deleteRowsAtIndexPaths:[NSArray arrayWithObjects:indexPath] 
                                      withRowAnimation:UITableViewRowAnimationFade];  
    

    won’t work.
    Deleting object from array will work. You don’t have to delete row from your table. Just reload table :

     - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
    
        if (editingStyle == UITableViewCellEditingStyleDelete) {
            // Delete the row from the data source
            [self.reports removeObjectAtIndex:indexPath.row];
            [tbl reloadData];
    }  
    

    But do take care that you are putting the correct indexNumber.

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

Sidebar

Related Questions

I have been trying to get this one section of my UI to immediatly
I have an XML file which has many section like the one below: <Operations>
I have a database name "CUED" (sqlite Android)it have a table HELLO which contain
Quick one. I'm overlooking something... I have a grouped table view that is built
I have about 10,000 products in the product table. I want to retrieve one
I'm trying to delete a row from my table view and so far have
i have a very simple table with only one row that has a uiswitch
When working in Access, whenever I delete a record from one table - it's
Does any one have tried to customize default section index displayed in UITableView. I
I have the following one to many associations. Document has many Sections and Section

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.