UIRefreshControl( pull left to right refresh ) concept in UICollectionView horizontally

微笑、不失礼 提交于 2020-01-05 02:51: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?


回答1:


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

    }

}




回答2:


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



来源:https://stackoverflow.com/questions/22777176/uirefreshcontrol-pull-left-to-right-refresh-concept-in-uicollectionview-horiz

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!