Xcode 如何实现ckrefreshcontrol以支持ios5?
我已经看到,对于同时支持iOS5和iOS6的应用程序,CKRefreshControl可以用作UIRefreshControl的替代品。我已经找到了上面的代码,但我不知道如何实现它。说只是使用相同的代码。但是缺少了一些东西。控制代码在哪里Xcode 如何实现ckrefreshcontrol以支持ios5?,xcode,ios5,github,uirefreshcontrol,Xcode,Ios5,Github,Uirefreshcontrol,我已经看到,对于同时支持iOS5和iOS6的应用程序,CKRefreshControl可以用作UIRefreshControl的替代品。我已经找到了上面的代码,但我不知道如何实现它。说只是使用相同的代码。但是缺少了一些东西。控制代码在哪里 self.refreshControl = [[UIRefreshControl alloc] init]; 谢谢 1)将3个类和前缀添加到项目中: - CKParagraphStyle.h and CKParagraphStyle.m - CKPa
self.refreshControl = [[UIRefreshControl alloc] init];
谢谢 1)将3个类和前缀添加到项目中:
- CKParagraphStyle.h and CKParagraphStyle.m
- CKParagraphStyle.h and CKRefreshArrowView.m
- CKRefreshControl.h and CKRefreshControl.m
- CKRefreshControl-Prefix.pch (goes into TableVCs using Refresh).
2) 将QuartzCore.framework添加到目标库中
3) 添加此方法:
-(void)doRefresh:(CKRefreshControl *)sender {
NSLog(@"refreshing");
[self.refreshControl performSelector:@selector(endRefreshing) withObject:nil afterDelay:1.0];
}
最后,像往常一样使用UIRefreshControl,但选择doRefresh方法:
self.refreshControl = [[UIRefreshControl alloc] init];
[self.refreshControl addTarget:self action:@selector(doRefresh:) forControlEvents:UIControlEventValueChanged];
除了CKRefreshControl源本身之外,不需要任何特定的
CKRefreshControl
代码。当CKRefreshControl
首次发布时,您必须将对UIRefreshControl
的所有调用替换为对CKRefreshControl
的调用,然后根据您是在iOS 5上还是在iOS 6+上自动将其分派到正确的类
然而,由于最近来自非洲的捐款,这已不再必要。相反,只需针对CKRefreshControl源代码进行编译和链接,就可以在针对iOS 5时使用UIRefreshControl
类。因此,您只需继续使用[[UIRefreshControl alloc]init]
,它就会自动在iOS 5上工作
你为什么要相信我?因为我是第一个写
CKRefreshControl
的人。你看过你链接到的GitHub页面上的README.md了吗?GitHub存储库还提供了一个关于如何使用控件的清晰示例:如果您不了解如何在项目中设置库代码,请下载整个存储库并打开demo Xcode项目,看看它是如何链接进来的。我觉得有点愚蠢和懒惰。我确实读过自述。上面说的和约翰一样。像往常一样,只需使用UIRefreshControl行。嗯?我已经在许多其他项目中设置了库代码。但我看不到要添加的“库”。我真的不想下载、安装和仔细检查整个存储库,因为它似乎应该有一个简单的答案。