First, refresh the list
When a row of TableView data is modified, the data needs to be updated. There are two methods of refreshing:
(1) Refresh the entire list, that is, [self. TableView reloaddata];
(2) Only the changed line is refreshed. Of course, this method is more efficient than the first method.
Specific code:
nsindexpath *refreshcell = [Nsindexpath indexpathforrow : 3 insection:0];
[ self. TableView reloadrowsatindexpaths: [nsarrayarraywithobjects: Refreshcell,nil] withrowanimation: Uitableviewrowanimationnone];
Second, insert a row of data data
Nsindexpath *refreshcell = [nsindexpathindexpathforrow: 3 insection : 0 ];
nsarray *insertindexpaths = [Nsarray Arraywithobjects:refreshcell,nil];
/// Also, add data to the data list
[_metermodelarray insertobject:d evice atindex : i+ 1 ];
[ self. TableView insertrowsatindexpaths: insertindexpathswithrowanimation: Uitableviewrowanimationright];
Third, refresh the data of a section
Nsindexset *refreshsection=[[nsindexsetalloc]initwithindex: 1]; // Refresh a second Section
[ self. TableView reloadsections: refreshsection withrowanimation: Uitableviewrowanimationautomatic];
iv. inserting a section data
According to the above, you can change it, no longer write.
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
UPDATE, insert TableView a row of data or section data