numberOfSectionsInTableView is requested in/after viewDidLoad ONLY if tableview is empty
Posted
by
Ben Packard
on Stack Overflow
See other posts from Stack Overflow
or by Ben Packard
Published on 2012-09-06T21:20:05Z
Indexed on
2012/09/07
21:38 UTC
Read the original article
Hit count: 214
A simple tableviewController, empty. A modal that can be launched from a button. No data in the data source for the tableview, and no rows displayed.
I open the modal, use it to add an item, and return to the tableview controller. The tableview updates itself automatically, and the new row is displayed.
I add a second item. The table view does NOT update automatically.
I can tell by logging inside numberOfSectionsInTableView that even if I go to add the first item and cancel, the tableview refreshes - it asks for the number of sections, rows, and the cell to display (if there is one). But not if there is one pre-existing row in the table.
I've scoured my code but can't find anything that would cause the tableview to know when the first item is added, but none afterwards.
Any ideas?
EDIT - I have further narrowed my issue so will close this shortly and post a more specific question
© Stack Overflow or respective owner