Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
A pull-to-refresh view for iOS 5, 100% API-compatible with UIRefreshControl in iOS 6
branch: master

This branch is 2 commits behind instructure:master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
CKRefreshControl.xcodeproj
CKRefreshControl
RefreshControlDemo.xcodeproj
RefreshControlDemo
.gitignore
CKRefreshControl.podspec
LICENSE.txt
README.md

README.md

CKRefreshControl

Open source library providing iOS 5.0+ support for UIRefreshControl, which was introduced in iOS 6.0.

Using it is as simple as this:

UITableViewController *controller;

controller.refreshControl = [[UIRefreshControl alloc] init];
[controller.refreshControl addTarget:self action:@selector(doRefresh:) forControlEvents:UIControlEventValueChanged];

Yes, that's exactly the code you'd write on iOS 6. No changes required.

You can also configure the refresh control in a storyboard, or use the +appearance API proxies if you'd like. It all works just like you'd hope, but now you can deploy it back to iOS 5.0 as well. Just link against the static library the CKRefreshControl project provides, add the -ObjC linker flag, and you're ready to go.

iOS 5 example   iOS 6 example


Appearance

CKRefreshControl intentionally does not mimic the iOS 6 UIRefreshControl look and feel for iOS 5.0. Instead, it was designed to look more like the other pull-to-refresh controls commonly used in iOS 5-compatible apps. Thus, whether the user is running iOS 5 or iOS 6, they get an interface that fits in with other apps on the device.


Why the name?

CKRefreshControl was originally part of our internal "CanvasKit" library, used in building Instructure's iOS apps.


Implementation

In general, you won't even know you're using CKRefreshControl. On iOS 5, we register UIRefreshControl as a subclass of CKRefreshControl, which implements all the compatibility stuff. On iOS 6, we just get out of the way; UIRefreshControl is available natively, and we don't have to do anything.


But does it work?

Yes! Instructure is using it in shipping code with no problems. That said, if you find a bug, please let us know and we'll make it work.


Contributors


License

CKRefreshControl, and all the accompanying source code, is released under the MIT license. You can see the full text of the license in the accompanying LICENSE.txt file.

Something went wrong with that request. Please try again.