LoginSignup
0
0

More than 5 years have passed since last update.

ISRefreshControl(iOS4-compatible UIRefreshControl)

Last updated at Posted at 2013-09-11

environment

Xcode: 4.6.3
Base SDK: iOS 6.1
Deployment Target: 5.1

ISRefreshControl

Install from GitHub

zsh
$ cd workspace
$ git clone https://github.com/ishkawa/ISMethodSwizzling.git
$ git clone https://github.com/ishkawa/ISRefreshControl.git
  1. Drag ISMethodSwizzling/ISMethodSwizzling/ & Drop Xcode Project Navigator
  2. Destination "Copy items into destination group's folder (if needed)" checked
  3. Folders "Create groups for any added folders" checked
  4. Add to targets main project checked
  5. Do the same above action for ISRefreshControl

For Example

uitableviewcontroller.m
#import "ISRefreshControl.h"

- (void)viewDidLoad
{
  self.refreshControl = (id)[[ISRefreshControl alloc] init];
  [self.refreshControl addTarget:self action:@selector(refreshTableView:) forControlEvents:UIControlEventValueChanged];
}

- (void)refreshTableView:(ISRefreshControl *)refreshControl
{
  dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
    sleep(1);
    dispatch_async(dispatch_get_main_queue(), ^{
      [refreshControl endRefreshing];
    });
  });
}
uiviewcontroller.m
#import "ISRefreshControl.h"

- (void)viewDidLoad
{
  ISRefreshControl *refreshControl = [[ISRefreshControl alloc] init];
  [self.tableView addSubview:refreshControl];
  [refreshControl addTarget:self action:@selector(refreshTableView:) forControlEvents:UIControlEventValueChanged];
}
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0