Use of the ego refresh for third-party libraries

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.