Uirefreshcontrol is using this control. This property is Refreshcontrol in Uitableviewcontroller.
The initialization of the table and the data settings are consistent with the general.
1: Initialize the Uirefreshcontrol control and bind the Pull event
// Add drop-down refresh control
*rc=[[ uirefreshcontrol ] ];
    RC. Attributedtitle alloc initwithstring : @ " dropdown refresh " ";
bind drop Event
[RC addTarget: self action:@selector(refreshtableview) forControlEvents:uicontroleventvaluechanged];
self. Refreshcontrol = RC;
2: Add a drop-down event function, request data in the drop-down event and modify the control state, bind the callback function
// pull-down action response function.
-(void) Refreshtableview
{
if(self. Refreshcontrol. Refreshing) {
Self.Refreshcontrol.Attributedtitle= [[NsattributedstringAlloc]initwithstring:@"Loading in ... "];
// Add Simulation Data
nsdate *now = [[nsdate alloc] init];
// adds a callback function that simulates the request. You need to close the load state after the request has ended.
[ self performselector:@selector(callbackmethod:) withobject: Now afterdelay:3];
}
}
3: Modify the control state in the callback function and update the data and table views.
-(void) Callbackmethod: (ID) obj
{
// End Load Status
[self. Refreshcontrol endrefreshing];
Self.Refreshcontrol.Attributedtitle= [[NsattributedstringAlloc]initwithstring:@"Drop-down refresh"];
// add data, Refresh table
[Self. ListData addobject:(nsdate *) obj];
[self. TableView reloaddata];
}
This article is from the "zhuoking" blog, make sure to keep this source http://9951038.blog.51cto.com/9941038/1772577
iOS presentation graph drop-down refresh control