The refresh button is added to the top right of the navigation bar, there is already a drop-down refresh function, now just don't want to go to the top of each refresh, so add a button like this.
Code:
Add Refresh button -2015.10.10
Uibarbuttonitem *refreshbtn = [[Uibarbuttonitem alloc]initwithtitle:@ " Refresh "
style:uibarbuttonitemstyleplain
target: Self
Action:@selector (Datarefresh)];
self. Navigationitem. Rightbarbuttonitem = refreshbtn;
Add complete -2015.10.10
# pragma mark event to add Refresh button-2015.10.10
-(void) datarefresh{
record The location of the current cell
float currentposition = self . TableView. Contentoffset. y;
NSLog (@ " current position y =%.f", currentposition);
Data Refresh
[Self egorefreshtableheaderdidtriggerrefresh:_refreshheaderview];
[self reloadtableviewdatasource];
[self loaddata];
the UI interface's offset does not change
[Self. tableView setcontentoffset:cgpointmake (self. TableView. Contentoffset. x, currentposition)];
animation effects
[self performselector:@selector (doneloadingtableviewdata) withobject:nil afterdelay: 1.0];
}
IOS Add Refresh button to refresh the current page