Ios 如何将刷新控件添加到视图控制器中的水平collectionview?

Ios 如何将刷新控件添加到视图控制器中的水平collectionview?,ios,swift,uicollectionview,Ios,Swift,Uicollectionview,我目前有: refresher = UIRefreshControl() refresher.attributedTitle = NSAttributedString(string: "Pull to refresh") refresher.addTarget(self, action: "refresh:", forControlEvents: UIControlEvents.ValueChanged) self.postsView.addSubview

我目前有:

        refresher = UIRefreshControl()
    refresher.attributedTitle = NSAttributedString(string: "Pull to refresh")
    refresher.addTarget(self, action: "refresh:", forControlEvents: UIControlEvents.ValueChanged)
    self.postsView.addSubview(refresher)

在包含collectionview的viewcontroller的viewdidload()中。与collectionview交互并使自定义单元格显示完美无瑕。但是,当我添加此复习时,它没有任何作用。我不知道为什么,我在这里漏了一步吗?谢谢

实现UIScrollview委托,请尝试下面的代码

- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
     CGPoint offset = scrollView.contentOffset;
     CGRect bounds = scrollView.bounds;
     CGSize size = scrollView.contentSize;
     UIEdgeInsets inset = scrollView.contentInset;
     float y = offset.x + bounds.size.width - inset.right;
     float h = size.width;


     float reload_distance = 75; //distance for which you want to load more
     if(y > h + reload_distance) {
        // write your code getting the more data
        NSLog(@"load more rows");

     }
 }

你能提供更多的信息吗?它出现了吗?或者它什么都不做。有什么错误吗?您是否检查了“刷新”功能是否正常工作。更常见的是它添加了collectionView的子视图?(应该是)。没有错误,它不会显示,当我向右滑动时(如果我从左开始查看第一个单元格),它也不会做任何事情。另外,“postsView”是集合视图的名称。hey@user100002因此刷新器实际上显示在UICollectionview的顶部,而不是左侧。关于为什么会发生这种情况有什么线索吗?我有水平弹跳和水平滚动。但当我打开“垂直反弹”并向下拉时,复习工具就在那里。可能是重复的。这也不在
Swift
中。