My app allows user to reorder rows in a table view, but I want to reloadData after moving is done to change something (add some text to the first row).
I tried to reloadData in moveRowAtIndexPath: method, but it makes the app hang because this method is called many time (according number of rows need to be moved) and the table view is reload many time.
So, I just want to know when the moving behavior is done then I reloadData in just one time. Does anyone know about this? Please help me. Thanks you so much!
You can do
[self performSelector:selector(doReload) withObject:nil afterDelay:0.1]in themoveRowAtIndexPathmethod but you can’t call[myTable reloadData]directly because as you found it causes a loop. Basically you need to allow the table manipulation to finish and the run loop to get around to calling your method which then causes a reload of your table. This is a bit of a hack but it works well. Ordinarily you don’t needreloadDataat this point but you may be trying to do something out of the ordinary.