iphone - UITableView with multiple sections : section with 1 row, deleting the row crashes the app -


I have a tableview with several sections when there is only one line in a section, And if I try to delete that line, my app crashes when executing this code:

  [tableView deleteRowsAtIndexPaths: [NSArray arrayWithObject: indexPath] withRowAnimation: Yes];  

I get this exception:

  *** Ending the application due to the exception of the exception 'NSRC Expansion', Reason: '*** - [NSCFRAA ObjectAntIndex:]: Index (0) Beyond Boundary (0) ' 

There is an array for each section. Each of these arrays contains the objects displayed in rows. Then there is another array in which these arrays are.

What am I doing wrong? Thank you.

Edit:

OK, I just saw in the debugger that it was the tableview: titleForHeaderInSection method, because I Getting the title of the section in the array, which I just removed ... so I was trying to use an array with 0 objects in it ...

< Div class = "post -text" itemprop = "text">

There is a source in the table view, and sections and pages displayed in the source The list of Tion. When you call [tableView deleteRowsAtIndexPaths: withRowAnimation:] , table view table goes to update, but the source is now out of sync (its the line you just deleted ). Its solution is to update the source (table or original data or whatever) before updating the table view.


Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -