Code Monkey home page Code Monkey logo

ckrefreshcontrol's Introduction

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.

ckrefreshcontrol's People

Contributors

bjhomer avatar eric-robinson avatar johnhaitas avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ckrefreshcontrol's Issues

Cannot call UIRefreshControl init method if running on iOS 5

Hello. It appears that if one wants this control working on iOS 5, the following code must be used instead:

self.refreshControl = (UIRefreshControl *)[[CKRefreshControl alloc] init];

If the normal [UIRefreshControl alloc] init] is used and if one runs iOS 5, the control doesn't seem to appear above the table view.

Steps to reproduce:

  1. Used cocoapods to install CKRefreshControl
platform :ios, '5.0'
pod 'CKRefreshControl', '~> 1.0.0'
  1. Opened the .xcworkspace that is generated by cocoapods
  2. Used the following code for my UITableView (note that it works fine in iOS 6 of course):
#import <CKRefreshControl/CKRefreshControl.h>
...
self.refreshControl = [[UIRefreshControl alloc] init];
        [self.refreshControl addTarget:self
                                action:@selector(refresh)
                      forControlEvents:UIControlEventValueChanged];
  1. The control doesn't appear in iOS 5 but appears in iOS 6

cannot import using "#import <CKRefreshControl/CKRefreshControl.h>"

CKRefreshControl is a subproject of an SDK that is a subproject with the app

able to import using:

import "CKRefreshControl.h"

not able to import using:

import <CKRefreshControl/CKRefreshControl.h>

The strange thing is that I am able to import SDWebImage just fine (also a subproject of SDK) using:

import <SDWebImage/UIImageView+WebCache.h>

this problem only occurs when Archiving

any ideas as to why this is the case?

ios 5.1 + plain style uitableview section header graphical glitch

On ios 5.1 simulator, when refresh control is refreshing and the user scrolls down, the first section header stays in place, overlapping the rest of the content (which is scrolling) .

The section header apparently thinks its already at the top of the scrollview and thus remains stationary. I dont know how much can be done about this, since its a UITableView feature, but it works correctly on ios 6 with UIRefreshControl so perhaps it can be fixed by modifying CKRefreshControl.

I wont have time to look into this during the next 1-2 months, possibly never (sorry), so if someone knows how to fix it, feel free.

Add initial tag

Adding an initial tag, and tagging subsequent versions, would allow for a .podspec to be created for this repo and could then be added to CocoaPods.

Rendering Issue with Indexed UITableView

Hi, first of all thanks for the work on this component, it's a really swell idea to bring parity to iOS5 and 6 apps.

I'm hitting a rendering issue using CKRefreshControl with a UITableView that uses an index. Whenever a CKRefreshControl is present interactions with the index control causes the index to "jump" out of place and then snap back in a very unpleasing way. The issue is not present in iOS 6 (where UIRefreshControl is used) and goes away when CKRefreshControl is not present in iOS 5.

I've captured the behavior occurring in the simulator in this short video: https://dl.dropbox.com/u/10239781/CKScrollIssue.mov

In the spirit of open source, I will attempt to debug this on my own, but wanted to post a note here to see if this is a known issue.

-e

Fails to compile for old iPad.

Tried to compile an app for a iPad one. CFRefreshCOntrol fails with

/Users/derekclarkson/projects/CashManagement/External/CKRefreshControl/CKRefreshControl/CKRefreshControl.m:497:2: error: Unsupported CP
#error Unsupported CPU
^
1 error generated.

I deduced that the CPU macro being returned TARGET_CPU_ARM64 and by adding the following patch I was able to get it to run.

diff --git a/CKRefreshControl/CKRefreshControl.m b/CKRefreshControl/CKRefreshControl.m
index fdf11a37af64764e0dc30f8d6c365e823eb32b44..6a2f71723c8a99d735d23e294eaf29a8734c4531 100644
--- a/CKRefreshControl/CKRefreshControl.m
+++ b/CKRefreshControl/CKRefreshControl.m
@@ -492,6 +492,7 @@ static void CKRefreshControl_UITableViewController_SetView(UITableViewController
               "L0: popl %0\n"
               "leal L_OBJC_CLASS_UIRefreshControl-L0(%0), %1" : "=r"(pc), "=r"(UIRefreshControlClassRef)
               );
+#elif  TARGET_CPU_ARM64
 #else
 #error Unsupported CPU
 #endif

I'm not sure if this is correct because I think it needs some asm, but I don't have the knowledge to work it out.

Can this be looked at and patched please.

Cocoa pods problem

This version is not working using cocoa pods, it crashes on iOS 5.0. But if you download the project directly it works.
Tag 1.0.0 is different from Branch. CKParagraphStyle is missing, and there are changes in other files.

issue using CKrefreshcontrol with IUTableView inside UIViewController

Hello, first of all thanks for the work on this component!

I'm trying to use the component to refresh a UiTableView in a UIViewController, but i cannot make it work :-(

This is my code:

UIRefreshControl *refresh = [[UIRefreshControl alloc] init];
[refresh addTarget:self.TableView action:@selector(doRefresh:) forControlEvents:UIControlEventValueChanged];

The project compile successfully, but the control doesn´t work

can anyone help me, please?

In 5.1 Simulator getting "dyld: Symbol not found: _OBJC_CLASS_$_UIRefreshControl"

I'm using Xcode 4.6.2 and adding CKRefreshControl 1.1.0 as a CocoaPod to my project that supports iOS 5 and up. When attempting to run on the iOS 5.1 (or 5.0) simulator, this message shows up in the console:

dyld: Symbol not found: OBJC_CLASS$_UIRefreshControl
Referenced from: /Users/jmedf/Library/Application Support/iPhone Simulator/5.1/Applications/4DA1DA57-47E6-4D77-B635-6ED600782758/MY_APP.app/MY_APP
Expected in: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk/System/Library/Frameworks/UIKit.framework/UIKit

I followed the steps on the readme. The only difference is we are initializing this way:

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

Everything works as expected in iOS 6. I can only deduce that this class can't see CKRefreshControl. I'm importing with:

import "CKRefreshControl.h"

building for iOS device

CKRefreshControl is a dependency of a static library

error is as follows:

Undefined symbols for architecture armv7s:
"OBJC_CLASS$_CKRefreshControl", referenced from:
objc-class-ref in libTGOSDK.a(TGOViewController.o)
ld: symbol(s) not found for architecture armv7s
clang: error: linker command failed with exit code 1 (use -v to see invocation)

was previously working with changes i made on bad pull request earlier ...

can be fixed by removing ONLY_ACTIVE_ARCH = YES; from Debug configuration

Do I need to add libCKRefreshControl.a manually?

Hello,

Thank you very much for this addition, it is the perfect solution! I don't know if this is the best way to contact you, but I've just joined so it seemed to be the easiest way :)

I am having a small problem, I looked through the demo files and saw that libCKRefreshControl.a was added within the demo project but I could not find this file in the repository or the downloaded files?

Is this file created once the -ObjC linker flag is added? I was receiving EXC_BAD_ACCESS - then I realised I had not included the flag, so until then I will keep trying.

Regards,
Craig

xcode 5 storyboard UIRefreshControl error

Using the UIRefreshControl directly in a storyboard triggers the following error in xCode5:

..../CKRefreshControl/RefreshControlDemo/en.lproj/MainStoryboard.storyboard: error: Class Unavailable: UIRefreshControl on iOS versions prior to 6.0

Adding the control programmatically still works fine.
But the Demo project on 1.1.1 has this error with the latest xCode 5.0

Unsupported CPU

Hi,
I run the dome,but "Unsupported CPU" error.
Something wrong with it.

Regards,
Vienta

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.