Drop-down refresh, pull-up load more

Source: Internet
Author: User

1. System Control Uirefreshcontrol

How to use:

Only useful for Uitableviewcontroller, unable to pull up refresh, init or viewdidload to create Uirefreshcontrol, set text, color and other information, automatic system Management Uirefreshcontrol, Automatically add to the TableView view, add methods to Uirefreshcontrol, call when the value changes, method for data request, after the request data confirmation is completed, call the Endrefreshing method, close the refresh;
#import "ViewController.h"@interfaceViewcontroller ()@end@implementationViewcontroller- (void) viewdidload {[Super viewdidload]; [Self Setuprefresh];}/** * Integrated pull -down refresh*/-(void) setuprefresh{//1. Adding a Refresh controlUirefreshcontrol *control=[[Uirefreshcontrol alloc]init]; Control.attributedtitle= [[Nsattributedstring alloc] initwithstring:@"try to load in ..."]; Control.tintcolor=[Uicolor Graycolor];    [Control addtarget:self Action: @selector (Refreshstatechange:) forcontrolevents:uicontroleventvaluechanged];        [Self.tableview Addsubview:control]; //2. Immediately into the refresh state, does not trigger the Uicontroleventvaluechanged event[Control beginrefreshing]; //3. Loading Data[self Refreshstatechange:control];}/** * Uirefreshcontrol into the refresh state: Load the latest data*/-(void) Refreshstatechange: (Uirefreshcontrol *) control{NSLog (@"refreshed the"); [Control endrefreshing];}@end
View Code

Drop-down refresh, pull-up load more

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.