Use MJRefresh with UICollectionView and WKWebView
masterMJRefresh supports various scrollable controls:
UICollectionView
- Drop-down refresh: Set
collectionView.mj_header. - Pull-to-refresh: Set
collectionView.mj_footer. - Trailer refresh (Side pull): Set
collectionView.mj_trailerusingMJRefreshNormalTrailer.
WKWebView
- To add refresh controls to a
WKWebView, apply the header to its underlyingUIScrollView:self.webView.scrollView.mj_header = ...
// UICollectionView Drop-down
self.collectionView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{ ... }];
// UICollectionView Pull-to-refresh
self.collectionView.mj_footer = [MJRefreshAutoNormalFooter footerWithRefreshingBlock:^{ ... }];
// UICollectionView Trailer (Side pull)
self.collectionView.mj_trailer = [MJRefreshNormalTrailer trailerWithRefreshingBlock:^{ ... }];
// WKWebView Drop-down
self.webView.scrollView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{ ... }];