UIRefreshControl( pull left to right refresh ) con

2019-07-23 08:27发布

I have a custom horizontal collection view that has 1 row and I want to add pull to refresh functionality which, by default, appears above my row of cells. I would like the user to be able to pull the collection view from left to right to activate the UIRefreshControl. Any ideas?

2条回答
地球回转人心会变
2楼-- · 2019-07-23 09:08

Use this http://code4app.net/ios/RefreshView/5247b46b6803fa7304000000.it is used to refresh the view ,in the same manner u can refresh the collectionView.

查看更多
甜甜的少女心
3楼-- · 2019-07-23 09:13

For this you need to implement the UIScrollViewDelegate method

- (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");

    }

}

查看更多
登录 后发表回答