First of all, it's a pity if it is not formatted correctly, the first time it is done. I used stackoverflow to find help for a long time, and it was very helpful (thank you all), but this is the first time I posted my question. This question has been asked many times, but when I call [myTable reloadTable], the methods numberOfSectionsInTableView and numberOfRowsInSection are called, but not cellForRowAtIndexPath.
Each answer that I saw during the search was changed: 1) TableView is zero 2) numberOfRowsInSection - 0 3) the delegate / data source tableView is not set 4) the reloadTable call in the wrong uiTableView.
None of them are suitable for me, so I wonder what else might be wrong.
What I'm trying to do: I have a custom uitableviewcell with a button on it when the button is pressed. I want to change the attributes of a cell (for example, let me say that I want to change the name of the cell to "Button Pressed"). Then I want to pause for a moment, and then delete the cell.
Not sure if this is important, but my tableView is inside a UIViewController, and viewController is a delegate and dataSource.
I have a method (below) that fires when I click a button and change the attributes of a cell if necessary, however, when I try to update a table to show the changes, it does not work. The first time [remTable reloadData] is called, numberofsectionsintableview and numberofrowsinsection are called, but not cellforrowatindexpath. However, the second time [remTable reloadData] all three methods are called, and everything works correctly.
doneCell.remName.text=@ "BUTTON PRESSED"; [remTable reloadData]; NSLog(@"sleep"); sleep(1); [remList removeObject:doneReminder]; [remTable reloadData];
To test this, I put the nslog statements at the beginning of numberofsections, numberofrows and cellforrow, the output is the name of the method followed by the number (for numberofsections / numberofrows).
Output:
numberofsections 1 numberofrows 3 sleep numberofsections 1 numberofrows 2 cellforrow
Any ideas on why cell rage isn't called for the first time? Thanks in advance, please let me know if anything else I can add to clarify.