有水平的UIRefreshControl吗? [英] Is there a horizontal UIRefreshControl?

查看:125
本文介绍了有水平的UIRefreshControl吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您可以将 UIRefreshControl 添加到 UICollectionView (或任何 UIScrollView 就此而言)通过,将它移回目标C应该很简单。

我所做的全部是在这里添加一个实用功能和一些条件那里。


You can add UIRefreshControl to UICollectionView (or any UIScrollView for that matter) by adding it to collection's subviews:

UIRefreshControl *refreshControl = [[UIRefreshControl alloc] init];
[refreshControl addTarget:self action:@selector(handleRefresh:) forControlEvents:UIControlEventValueChanged];
[self.collectionView addSubview:refreshControl];

This doesn't work when collection view layout has UICollectionViewScrollDirectionHorizontal.

I tried overriding layoutSubviews to put refresh control to the left, but it wouldn't track scrolling progress this way. Can I trick it into working with horizontal layouts?

解决方案

I couldn't find any existing solutions so I extended ODRefreshControl with horizontal layout support:

I needed solution in MonoTouch (C#) so I started by source-porting ODRefreshControl and then patched it to work with horizontal layout.

Full C# source code is here, it should be straightforward to port it back to Objective C.
All I did was add an utility function and some conditions here and there.

这篇关于有水平的UIRefreshControl吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆