I’ve been adding a temporary row to the end of my table view so I can limit the amount of data loaded / improve the speed of loading the view.
However, I didn’t think about the delete feature. Where they swipe right to delete a row..
In my commitEditingStyle event I have, my check to see if it is a delete, then delete row from database, removeObjectAtIndex from my data array, beginUpdates, deleteRowsAtIndexPaths and if zero items left in my table insertRowsAtIndexPath with fade, so that my no transactions row will appear then endUpdates.
I did think when I add my tap for more rows I’d assign the row index to a variable and delete this row first in the commitEditingStyle event. However, I’d then have to query my database just to add another row, then add the tap for more rows row.
Which seems a lot of work for a quick fix.
Of course, I could just do a reloadData, but this seems really bad, but might be my only option.
I do eventually want to move to Core Data, but I really need to get this release out the door, its quite a complicated screen with segmented control for different data views and tap to edit the row in another view.
Can anyone advise me about some kind of trick / event I may have missed or another approach I could quickly use in this scenario ?
Make “tap for more” your table footer view instead of another cell. You will have to do this anyway if you move to core data and NSFetchedResultsController since hacking in an extra row becomes very complex then.
Your table footer view will just be a button (or some other view styled how you like it) – this can be created on viewDidLoad and set up with actions etc. It does not form part of your data model at all, so you have nothing extra to do in your datasource methods.