Pull-to-refresh in UICollectionViewController

后端 未结 5 1063
闹比i
闹比i 2021-01-29 19:06

I want to implement pull-down-to-refresh in a UICollectionViewController under iOS 6. This was easy to achieve with a UITableViewController, like so:

5条回答
  •  遇见更好的自我
    2021-01-29 19:50

    The refreshControl property has now been added to UIScrollView as of iOS 10 so you can set the refresh control directly on collection views.

    https://developer.apple.com/reference/uikit/uiscrollview/2127691-refreshcontrol

    UIRefreshControl *refreshControl = [UIRefreshControl new];
    [refreshControl addTarget:self action:@selector(refreshControlAction:) forControlEvents:UIControlEventValueChanged];
    self.collectionView.refreshControl = refreshControl;    
    

提交回复
热议问题