11# YCRefreshControl
2- ___ __
3- / (_)_ ____ _____ ____/ / __ _____
4- / / / // / // / -_) __/ _ \/ // / _ \
5- /_/_/\_, /\_,_/\__/\__/_//_/\_,_/_//_/
6- /___/
72
8- 1.项目贡献者:黎跃春 & 王广威
93
10- 2.技术讨论群:343640780
4+ ___ __
5+ / (_)_ ____ _____ ____/ / __ _____
6+ / / / // / // / -_) __/ _ \/ // / _ \
7+ /_/_/\_, /\_,_/\__/\__/_//_/\_,_/_//_/
8+ /___/
119
12- 3.UIScrollView(UITableView,UICollectionView)的使用方法
13- UITableView和UICollectionView都是UIScrollView的子类,直接将上面的scrollView对象换成UITableView或者UICollectionView的对象即可,当手动下拉时就会触发块方法。
1410
15- UIScrollView * scrollView = [[ UIScrollView alloc] initWithFrame: CGRectMake (0, 64, WScreenWidth, WScreenHeight)] ;
11+ ##YCRefreshControl是什么?
12+ 这是一款基于UIScrollView的轻量级,简易的的零配置的上下拉刷新控件。
13+
14+ ##YCRefreshControl使用方法?
15+
16+ * 下载demo,直接将YCRefreshControl文件夹拖拽到工程中,在您要使用刷新的控制器里面直接导入YCRefreshControl.h头文件即可。
17+
18+
19+ * 因为UICollectionView,UITableView都是UIScrollView的子类,所以UIScrollView,UICollectionView,UITableView的使用方法一样
20+ <html >
21+
22+
23+ UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 64, WScreenWidth, WScreenHeight)];
1624 self.scrollView = scrollView;
1725 [self.view addSubview:scrollView];
26+
1827 [scrollView setContentSize:CGSizeMake(self.view.frame.size.width, self.view.frame.size.height)];
1928 @weakify(scrollView);
2029 [scrollView setRefreshAction:^{
@@ -25,19 +34,16 @@ UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 64,
2534 });
2635 }];
2736
37+ </html >
2838
39+ * UIWebView不是UIScrollView的子类,但是UIWebView有一个scrollView属性, UIWebView的使用方法如下。
2940
30- 4.UIWebView的使用方法
3141
32-
33- UIWebView * webView = [[ UIWebView alloc] initWithFrame: CGRectMake (0, 64, WScreenWidth, WScreenHeight - 64)] ;
34- [ self.view addSubview: webView ] ;
35-
36- UIScrollView * scrollView = webView.scrollView;
37- _ initArray = @[ @"https://github.com/LiYueChun ", @"http://www.jianshu.com/users/336468483205/latest_articles ", @"http://weibo.com/mobiledevelopment ", @"http://blog.sina.com.cn/technicalarticle" ] ;
38- @weakify (scrollView);
39- @weakify (webView);
40- [ scrollView setRefreshAction:^{
42+ UIScrollView * scrollView = webView.scrollView;
43+ _ initArray = @[ @"https://github.com/LiYueChun ", @"http://www.jianshu.com/users/336468483205/latest_articles ", @"http://weibo.com/mobiledevelopment ", @"http://blog.sina.com.cn/technicalarticle" ] ;
44+ @weakify (scrollView);
45+ @weakify (webView);
46+ [ scrollView setRefreshAction:^{
4147 @strongify (scrollView);
4248 @strongify (webView);
4349 dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
@@ -47,16 +53,47 @@ UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 64, WScreenW
4753 NSURLRequest * request = [ NSURLRequest requestWithURL: url ] ;
4854 [ webView loadRequest: request ] ;
4955 [ scrollView endRefresh] ;
50- });
51- }] ;
56+ });
57+ }] ;
58+
59+ NSString * path = @"http://weibo.com/mobiledevelopment ";
60+ NSURL * url = [ NSURL URLWithString: path ] ;
61+ NSURLRequest * request = [ NSURLRequest requestWithURL: url ] ;
62+ [ webView loadRequest: request ] ;
63+
64+ ##有问题反馈
65+ 在使用中有任何问题,欢迎反馈给我,可以用以下联系方式跟我交流
66+
67+ * 邮件:(liyuechun2009@163.com )
68+ * QQ群: 343640780
69+ * weibo: [ @千锋教育黎跃春] ( http://weibo.com/mobiledevelopment )
70+
71+ ##您的鼓励是我前进的动力
72+ 在兴趣的驱动下,写一个` 免费 ` 的东西,有欣喜,也还有汗水,希望你喜欢我的作品,同时也能支持一下。有钱的捧个钱场,没钱的回家拿钱捧个钱场,star一下。
73+
74+
75+ ##项目贡献者
76+
77+
78+ <table border = ' 1 ' height = ' 80 ' >
79+ <tr align = 'center'>
80+ <td width = '120'>项目贡献者</td>
81+ <td width = '120'>联系QQ</td>
82+ </tr>
83+ <tr align = 'center'>
84+ <td width = '120'>黎跃春[笑傲人生]</td>
85+ <td width = '120'>939442932</td>
86+ </tr>
87+ <tr align = 'center'>
88+ <td width = '120'>王广威</td>
89+ <td width = '120'>524968369</td>
90+ </tr>
91+ </table >
92+
93+
5294
53- NSString *path = @"http://weibo.com/mobiledevelopment";
54- NSURL *url = [NSURL URLWithString:path];
55- NSURLRequest *request = [NSURLRequest requestWithURL:url];
56- [webView loadRequest:request];
5795
5896
59- 5.UIScrollView(UITableView,UICollectionView),UIWebView的上下拉刷新详见Demo
6097
6198
6299
0 commit comments