import UIKit class GalleryListViewController: UIViewController,UICollectionViewDataSource,UICollectionViewDelegateFlowLayout { let refreshControl = UIRefreshControl() //下拉刷新 @IBOutlet weak var collectionView: UICollectionView! override func viewDidLoad() { super.viewDidLoad() self.configureRefresh() } //设置下拉和上啦刷新 func configureRefresh(){ self.collectionView?.header = MJRefreshNormalHeader(refreshingBlock: { () in print("header") self.RefreshData() self.collectionView?.header.endRefreshing() }) self.collectionView?.footer = MJRefreshAutoFooter(refreshingBlock: { () in print("footer") self.loadData() self.collectionView?.footer.endRefreshing() }) } }