Using Uirefreshcontrol to implement TableView pull-down refresh

Source: Internet
Author: User

- (void) Viewdidload {[SuperViewdidload];//The Self->viewcontroller here inherit from UitableviewcontrollerUirefreshcontrol *refresh = [[Uirefreshcontrol alloc] Initwithframe:cgrectzero]; Refresh. Attributedtitle= [[Nsattributedstring alloc] initwithstring:@"Drop-down refresh"]; Self. Refreshcontrol= Refresh; [Refresh AddTarget: SelfAction@selector(_loaddata) forcontrolevents:uicontroleventvaluechanged];} - (void) _loaddata {//What to do if you add a drop-down refresh here    NSLog(@"Drop-down refresh");//drop-down refreshes when the displayed text is refreshed     Self. Refreshcontrol. Attributedtitle= [[Nsattributedstring alloc] initwithstring:@"Drop-down refresh"];//End Refresh state method call, this is just a test[ SelfPerformselector:@selector(_endload) Withobject:NilAfterdelay:2];} - (void) _endload {//End drop-down action to refresh status    NSLog(@"End");//End drop-down refresh when the displayed text is refreshed     Self. Refreshcontrol. Attributedtitle= [[Nsattributedstring alloc] initwithstring:@"E N D"]; [ Self. RefreshcontrolEndrefreshing];//    }

Uirefreshcontrol class only applies to the system after iOS6, of course, the refresh effect style is diverse, we can use the third-party framework, Mjrefresh framework is currently on GitHub, this class of third-party stars, we wrote.
Mjrefresh Framework Download

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Using Uirefreshcontrol to implement TableView pull-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.