iOS egorefreshtableheaderview drop-down refresh

Source: Internet
Author: User

The first stepDrag the EGORefreshTableHeaderView.h, egorefreshtableheaderview.m two files, and the set of picture packages provided by Enormego into your project.
Step TwoRootViewController.hAdd the appropriate element:


@interface rootviewcontroller:uiviewcontroller  < uitableviewdatasource,uitableviewdelegate,egorefreshtableheaderdelegate,uiscrollviewdelegate>{

Egorefreshtableheaderview *_refreshheaderview;
BOOL _reloading;
}


Egorefreshtableheaderview *view =[[egorefreshtableheaderview alloc] Initwithframe:cgrectmake (0.0f, 0.0f- Self.tableView.bounds.size.height, Self.view.frame.size.width, Self.tableView.bounds.size.height)];
View.delegate = self;
[Self.tableview Addsubview:view];
_refreshheaderview = view;
[_refreshheaderview Refreshlastupdateddate];
}

#pragma mark-
#pragma mark Data Source loading/reloading Methods
-(void) reloadtableviewdatasource{
_reloading =yes;
}

-(void) doneloadingtableviewdata{
_reloading =no;
[_refreshheaderview EgoRefreshScrollViewDataSourceDidFinishedLoading:self.tableView];

}


#pragma mark-
#pragma Mark Uiscrollviewdelegate Methods
-(void) Scrollviewdidscroll: (Uiscrollview *) scrollview{
[_refreshheaderview Egorefreshscrollviewdidscroll:scrollview];
}

-(void) scrollviewdidenddragging: (Uiscrollview *) ScrollView willdecelerate: (BOOL) decelerate{
[_refreshheaderview Egorefreshscrollviewdidenddragging:scrollview];
}


#pragma mark-
#pragma Mark Egorefreshtableheaderdelegate Methods
-(void) Egorefreshtableheaderdidtriggerrefresh: (egorefreshtableheaderview*) view{
[Self reloadtableviewdatasource];
[Self performselector: @selector (doneloadingtableviewdata) Withobject:nil afterdelay:3.0];
}

-(BOOL) egorefreshtableheaderdatasourceisloading: (egorefreshtableheaderview*) view{
return _reloading;
}

-(nsdate*) egorefreshtableheaderdatasourcelastupdated: (egorefreshtableheaderview*) view{
Return[nsdate Date];
}

 

iOS egorefreshtableheaderview drop-down refresh

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.