- (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