Pull-to-refresh in UICollectionViewController

后端 未结 5 985
闹比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:45

    I was looking for the same solution, but in Swift. Based on the above answer, I have done the following:

    let refreshCtrl = UIRefreshControl()
        ...
    refreshCtrl.addTarget(self, action: "startRefresh", forControlEvents: .ValueChanged)
    collectionView?.addSubview(refreshCtrl)
    

    Not forgetting to:

    refreshCtrl.endRefreshing()
    

提交回复
热议问题