加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

objective-c – 是否有水平UIRefreshControl?

发布时间:2020-12-16 03:48:12 所属栏目:百科 来源:网络整理
导读:您可以在 adding it to collection’s subviews之前将UIRefreshControl添加到UICollectionView(或任何UIScrollView): UIRefreshControl *refreshControl = [[UIRefreshControl alloc] init];[refreshControl addTarget:self action:@selector(handleRefresh
您可以在 adding it to collection’s subviews之前将UIRefreshControl添加到UICollectionView(或任何UIScrollView):
UIRefreshControl *refreshControl = [[UIRefreshControl alloc] init];
[refreshControl addTarget:self action:@selector(handleRefresh:) forControlEvents:UIControlEventValueChanged];
[self.collectionView addSubview:refreshControl];

当集合视图布局具有UICollectionViewScrollDirectionHorizontal时,这不起作用.

我尝试覆盖layoutSubviews以将刷新控制放在左侧,但它不会以这种方式跟踪滚动进度.我可以欺骗它使用水平布局吗?

解决方法

我找不到任何现有的解决方案,所以我扩展了 ODRefreshControl并支持水平布局:

我需要在MonoTouch(C#)中使用解决方案,所以我开始使用源代码移植ODRefreshControl,然后使用水平布局移植到patched it to work.

完整的C#源代码是here,将它移回Objective C应该很简单.我所做的就是在这里和那里添加一个实用功能和一些条件.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读