1. Import the third-party library into the project
2. #import "EGORefreshTableHeaderView.h"
3. Interfaces that need to be refreshed comply with the protocol
4.//created on top of TableView
-(void) creategoheardview{
_heardview = [[Egorefreshtableheaderview alloc] Initwithframe:cgrectmake (0,-self.tableview.bounds.size.height, Self.tableView.bounds.size.width, Self.tableView.bounds.size.height)];
Set up Proxy
_heardview.delegate = self;
Set the last Refresh time
[_heardview Refreshlastupdateddate];
[Self.tableview Addsubview:_heardview];
}
#pragma mark-the way to implement the ScrollView protocol
-(void) Scrollviewdidscroll: (Uiscrollview *) scrollview{
To call when scrolling the view scrolls
[_heardview Egorefreshscrollviewdidscroll:scrollview];
}
-(void) scrollviewdidenddragging: (Uiscrollview *) ScrollView willdecelerate: (BOOL) decelerate{
Call when dragging is stopped
[_heardview Egorefreshscrollviewdidenddragging:scrollview];
}
#pragma methods in the Mark-ego protocol
Returns whether or not it is currently being refreshed and does not refresh if it is being refreshed.
The return yes means that the refresh is not refreshed at this time.
The returned no indicates that no refresh is currently available to refresh
-(BOOL) egorefreshtableheaderdatasourceisloading: (Egorefreshtableheaderview *) view{
return _isrefreshing;
}
Called when it is refreshed
-(void) Egorefreshtableheaderdidtriggerrefresh: (Egorefreshtableheaderview *) view{
if (_isrefreshing) {
Return
}
_isrefreshing = YES;
_currentpage = 1;
[Self loaddatapage:_currentpage count:20];
}
Returns the time of the most recent refresh
-(NSDate *) egorefreshtableheaderdatasourcelastupdated: (Egorefreshtableheaderview *) view{
return [NSDate Date];
}
At last
[Self.tableview Reloaddata];
Set to No indicates that no download is currently available
_isloading = NO;
Refresh End
_isrefreshing = NO;
The update has been completed to stop the refresh
[_heardview EgoRefreshScrollViewDataSourceDidFinishedLoading:self.tableView];
Use of the ego refresh for third-party libraries