TableView for IOS-built-in refresh, EGO, and search display controller

Source: Internet
Author: User

In the past few days, due to a problem with the local network, all webpages except Q and Weibo cannot be accessed. The blog has not followed up. I recovered today, so I continued to update my blog. I also hope you can continue to comment on it or give me some suggestions or exchange ideas:-) Today, I found a previous TableView example, mainly about uploading and refreshing, so I wrote a demo, then update it to the blog. Built-in refresh built-in refresh is an API launched after Apple IOS6. It mainly adds an attribute refreshControl for TableViewController. If you want to use this built-in drop-down refresh function, you 'd better specify a dedicated View Controller for your TableView. In use, we need to specify a UIRefreshControl object for refreshControl. It is not difficult to check the three attributes in the header file and initialize the three methods, then configure the refreshControl [cpp]/****** built-in refresh common attribute settings ******/UIRefreshControl * refresh = [[UIRefreshControl alloc] init]; refresh. attributedTitle = [[NSAttributedString alloc] initWithString: @ "pull-down refresh"]; refresh. tintColor = [UIColor blueColor]; [refresh addTarget: self action: @ selector (pullToRefresh) forControlEvents: UIControlEventValueChanged]; self. refreshControl = refresh; a listener is set. [Cpp] // pull-down refresh-(void) pullToRefresh {// simulate network access to [UIApplication sharedApplication]. networkActivityIndicatorVisible = YES; self. refreshControl. attributedTitle = [[NSAttributedString alloc] initWithString: @ "refreshing"]; double delayInSeconds = 1.5; interval popTime = dispatch_time (interval, (int64_t) (delayInSeconds * seconds )); dispatch_after (popTime, dispatch_get_main_queue (), ^ (Void) {_ rowCount + = 5; [self. tableView reloadData]; // set the refresh control when the refresh ends [self. refreshControl endRefreshing]; self. refreshControl. attributedTitle = [[NSAttributedString alloc] initWithString: @ "pull-down refresh"]; [UIApplication sharedApplication]. networkActivityIndicatorVisible = NO; _ bottomRefresh. frame = CGRectMake (0, 44 + _ rowCount * RCellHeight, 320, RCellHeight) ;});} Because network access is not actually performed here, so here we use a method called dis to simulate network access latency. Patch_after is not difficult about this GCD method. You only need to set the delay time and the code in the delayed end Block.

Related Article

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.