先列举这个工程中用到的oc源码库: git
注意头文件名字的命名规范:项目名称-Brdging-Header.h,以下图。github
导入成功后,接下来测试如何引用,下面以及调用MJRefresh库为例,只要UIRefreshControl声明变量能编译能经过,就说明能正常调用,具体使用方法参见MJRefresh的相关文档: xcode
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() }) } }
完!缓存