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
- Drag ISMethodSwizzling/ISMethodSwizzling/ & Drop Xcode Project Navigator
- Destination "Copy items into destination group's folder (if needed)" checked
- Folders "Create groups for any added folders" checked
- Add to targets main project checked
- 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];
}