问题
every one. I'm a new for iphone.
I saw some document for iphone develop, but I don't understand the [xxx reloadData]; with tableView yet.
When i use this method, my all cells are cleared. What happened?
I don't understand it.
回答1:
It means you force the UITableView
to get the data and refresh itself. It is what you wanna do after you changed something in your data source.
For example, I have a NSMutableArray
of three objects a, b and c. I have a button to delete an object, say b. After I pressed my button and get object b deleted from my array, my table view won't reload unless I call [myTableViewName reloadData]
to force it refresh itself.
If after you do [xxx reloadData]
, you got nothing. It means, your data needed for the table view is not there anymore. So track the data source and see if the data got changed.
回答2:
As the documentation indicates, reloadData
will simply force the list to refresh by querying your datasource and delegate. Please see http://developer.apple.com/library/ios/#documentation/uikit/reference/UITableView_Class/Reference/Reference.html and post some code if you have problems.
来源:https://stackoverflow.com/questions/10823355/what-is-reloaddata-function