Developer IOS library pull-down refresh-WCPullRefreshControl, ios pull-down refresh

Source: Internet
Author: User

Developer IOS library pull-down refresh-WCPullRefreshControl, ios pull-down refresh

Original Blog, reprinted, please indicate the source
Blog.csdn.net/hello_hwc
My Github
Https://github.com/wenchenhuang/WCPullRefreshControl

Preface:
I have been writing IOS code for a while. It is time to write several Github libraries, that is, to train myself and help people who need it.
This library is a pull-down refresh library. It took about 10 hours to develop it. It made screen adaptation, rotation adaptation, and some animations, the API design was changed three times. Finally, the first version is submitted to Github.
Address

Several Types

Features:

  • Screens of various sizes
  • Applicable to various scrollviews (UIScrollview, UITableview, UIWebview)
  • Supports device Rotation
  • Supports a maximum of 12 types of pull-down refreshes (3 types of SS, 4 types of refreshing, 3*4 = 12)
  • You can use Block or Delegate to pass events.
  • Supports Scrollview with navigation bar

Easy to use

Example 1 Use Block to pass events
The default style is used here.

@interface DemoTableview()<UIScrollViewDelegate>@property (strong,nonatomic)WCSimplePullRefreshControl * pullRefresh;@end@implementation DemoTableview-(void)viewDidLoad{    self.pullRefresh = [[WCSimplePullRefreshControl alloc] initWithScrollview:self.tableView Action:^{        [self performSelector:@selector(reset) withObject:nil afterDelay:2.0];    }];}-(void)reset{    [self.pullRefresh finishRefreshingSuccessully:YES];}-(void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate{    [self.pullRefresh updateWHenScrollDidEndDraging];}-(void)scrollViewDidScroll:(UIScrollView *)scrollView{    [self.pullRefresh updateWhenScrollviewScroll];}

Method 2: Use a proxy to pass events
Customized Style

@interface DemoTableview()<UIScrollViewDelegate,WCPullRefreshControlDelegate>@property (strong,nonatomic)WCSimplePullRefreshControl * pullRefresh;@end@implementation DemoTableview-(void)viewDidLoad{      self.pullRefresh = [[WCSimplePullRefreshControl alloc] initWithScrollview:self.tableView Action:NULL progressItem:WCProgressItemTypeMagicSquare refreshingItem:WCRefreshingItemTypeMagicSquare lastUpdate:nil showLastUpdate:NO textColor:[UIColor blueColor] itemColor:[UIColor grayColor] pullHeight:64];self.pullRefresh.delegate = self;}-(void)reset{    [self.pullRefresh finishRefreshingSuccessully:YES];}-(void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate{    [self.pullRefresh updateWHenScrollDidEndDraging];}-(void)scrollViewDidScroll:(UIScrollView *)scrollView{    [self.pullRefresh updateWhenScrollviewScroll];}-(void)DidStartRefreshingWithScrollview:(UIScrollView *)scrollview{    [self performSelector:@selector(reset) withObject:nil afterDelay:2.0];}@end

Follow-up
If a bug is found, leave a message in this blog or email: njuhwc@163.com

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.