These days because of the network of the place to live a little problem, in addition to the Q, on the micro-blog other than the Web page can not be landed. Blogs are not followed up.
Resumed today, so continue to update the blog. I also hope that you can continue to comment or give me some advice or exchange:-)
Today found a previous example of a tableview, mainly about up and down pull refresh, so wrote a demo, and then updated to the blog.
Built-in Refresh
Built-in refresh is Apple IOS6 after the introduction of an API, mainly for Tableviewcontroller added a property, Refreshcontrol, so if you want to use this built-in Drop-down refresh, it is best to Your TableView specifies a dedicated view controller.
When used, we need to assign a Uirefreshcontrol object to Refreshcontrol. Follow the header file to see
Three properties, the initialization of three methods, not difficult, and then configure Refreshcontrol
/****** built-in refresh of common generic
settings ******/
uirefreshcontrol *refresh = [[Uirefreshcontrol alloc] init];
Refresh.attributedtitle = [[Nsattributedstring alloc] initwithstring:@ "Drop-down refresh"];
Refresh.tintcolor = [Uicolor bluecolor];
[Refresh Addtarget:self action: @selector (Pulltorefresh)
forcontrolevents:uicontroleventvaluechanged];
Self.refreshcontrol = Refresh;
Set up a listening method to simply look at its implementation
Drop-down
Refresh
-(void) Pulltorefresh
{
//analog network access
[UIApplication sharedapplication]. networkactivityindicatorvisible = YES;
Self.refreshControl.attributedTitle = [[Nsattributedstring alloc] initwithstring:@ "Refresh
"];
Double delayinseconds = 1.5;
dispatch_time_t poptime = Dispatch_time (Dispatch_time_now, (int64_t) (Delayinseconds *
nsec_per_sec));
Dispatch_after (Poptime, Dispatch_get_main_queue (), ^ (void) {
_rowcount = 5;
[Self.tableview Reloaddata];
Refresh control settings At the end of the refresh
[Self.refreshcontrol endrefreshing];
Self.refreshControl.attributedTitle = [[Nsattributedstring alloc] initwithstring:@ "Drop-down
Refresh"];
[UIApplication sharedapplication].networkactivityindicatorvisible = NO;
_bottomrefresh.frame = CGRectMake (0, 44+_rowcount*rcellheight, rcellheight);}