Refresh UITableView
Methods: [Self.tableview Reloaddata];
Reloaddata is refreshing the entire uitableview, and sometimes we may need to refresh it locally. For example: Just refresh a cell, refresh only one section, and so on. This time in the call Reloaddata method, although the user can not see, but some waste resources.
Refresh Local cell
Method: Nsindexpath *indexpath = [Nsindexpath indexpathforrow:0 insection:0];
[Self.tableview Reloadrowsatindexpaths:[nsarray Arraywithobjects:indexpath,nil] WithRowAnimation: Uitableviewrowanimationfade];
This makes it easy to refresh the first cell of the first section. Although it looks like a lot of code, it does save resources. As few refreshes as possible, it is also an optimization of UITableView.
Partial Refresh section
Nsindexset *indexset = [[Nsindexset alloc] initwithindex:0];
[Self.tableview Reloadsections:indexset Withrowanimation:uitableviewrowanimationfade];
The above code is a No. 0 section refresh.
Refresh Animations
There are several animations to refresh UITableView:
typedef ns_enum (Nsinteger, uitableviewrowanimation) {
Uitableviewrowanimationfade,//Fade in
Uitableviewrowanimationright,//Slide right-in//slide
Uitableviewrowanimationleft,//slide in from left
Uitableviewrowanimationtop,//slide in from the top
Uitableviewrowanimationbottom,//slipped in from
Uitableviewrowanimationnone,//Available in IOS 3.0
Uitableviewrowanimationmiddle,//Available in IOS 3.2. Attempts to keep cell centered in the space it will/did occupy
Uitableviewrowanimationautomatic = +//Available in IOS 5.0. Chooses an appropriate animation style for you
};
IOS Refresh TableView method