你可以加UIRefreshControl
to UICollectionView
(或任何UIScrollView
就此而言)将其添加到集合的子视图中 https://stackoverflow.com/a/12502450/458193:
UIRefreshControl *refreshControl = [[UIRefreshControl alloc] init];
[refreshControl addTarget:self action:@selector(handleRefresh:) forControlEvents:UIControlEventValueChanged];
[self.collectionView addSubview:refreshControl];
当集合视图布局有时,这不起作用UICollectionViewScrollDirectionHorizontal http://developer.apple.com/library/ios/#Documentation/UIKit/Reference/UICollectionViewFlowLayout_class/Reference/Reference.html#//apple_ref/doc/c_ref/UICollectionViewScrollDirectionHorizontal.
我尝试覆盖layoutSubviews
将刷新控件放在左侧,但它不会以这种方式跟踪滚动进度。我可以欺骗它使用水平布局吗?
我找不到任何现有的解决方案,所以我扩展了ODRefreshControl https://github.com/Sephiroth87/ODRefreshControl具有水平布局支持:
我需要 MonoTouch (C#) 中的解决方案,因此我从源代码移植 ODRefreshControl 开始,然后修补它以使其工作 https://github.com/stampsy/MonoTouch.ODRefreshControl/blob/master/ODRefreshControl.cs具有水平布局。
完整的 C# 源代码是here https://github.com/stampsy/MonoTouch.ODRefreshControl/blob/master/ODRefreshControl.cs,将其移植回 Objective C 应该很简单。
我所做的只是添加一个实用函数和一些条件。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)