Supported Controls for MJRefresh
masterMJRefresh supports pull-to-refresh and drop-down refresh for the following UIScrollView subclasses:
UITableViewUICollectionViewWKWebViewUIScrollView
repository·master·Indexed 27 days ago
https://github.com/renzifeng/zfplayerAn iOS player template designed to decouple the player engine from the control layer. ZFPlayer allows developers to swap different player SDKs (such as AVPlayer or ijkplayer) and customize the UI control layer by conforming to the ZFPlayerMediaPlayback and ZFPlayerMediaControl protocols.
MJRefresh supports pull-to-refresh and drop-down refresh for the following UIScrollView subclasses:
UITableViewUICollectionViewWKWebViewUIScrollViewAdd the following line to your Podfile to include the FDFullscreenPopGesture library:
pod 'FDFullscreenPopGesture', '1.1'MJRefresh can be installed using CocoaPods, Carthage, or by manual import.
CocoaPods
pod 'MJRefresh'Carthage
github "CoderMJLee/MJRefresh"Manual Import
MJRefresh folder into your project.#import "MJRefresh.h"pod 'MJRefresh'UINavigationController instances will automatically support the iOS7+ style fullscreen pop gesture without any additional setup.Use MJRefreshAutoGifFooter to implement a footer that uses animated GIF images during the refreshing process. You must provide a target object and a selector for the action to be performed when the refresh status is entered.
// Set the callback(Once you enter the refresh status,then call the action of target, that is call [self loadMoreData])
MJRefreshAutoGifFooter *footer = [MJRefreshAutoGifFooter footerWithRefreshingTarget:self refreshingAction:@selector(loadMoreData)];
// Set the refresh image
[footer setImages:refreshingImages forState:MJRefreshStateRefreshing];
// Set footer
self.tableView.mj_footer = footer;To use animated images for the drop-down refresh, use MJRefreshGifHeader. You must set the images for each state: MJRefreshStateIdle, MJRefreshStatePulling, and MJRefreshStateRefreshing.
MJRefreshGifHeader *header = [MJRefreshGifHeader headerWithRefreshingTarget:self refreshingAction:@selector(loadNewData)];
[header setImages:idleImages forState:MJRefreshStateIdle];
[header setImages:pullingImages forState:MJRefreshStatePulling];
[header setImages:refreshingImages forState:MJRefreshStateRefreshing];
self.tableView.mj_header = header;MJRefreshGifHeader *header = [MJRefreshGifHeader headerWithRefreshingTarget:self refreshingAction:@selector(loadNewData)];
[header setImages:idleImages forState:MJRefreshStateIdle];
[header setImages:pullingImages forState:MJRefreshStatePulling];
[header setImages:refreshingImages forState:MJRefreshStateRefreshing];
self.tableView.mj_header = header;The library handles navigation bar transitions automatically (e.g., transitioning between views with and without bars). Instead of calling setNavigationBarHidden:animated: on the UINavigationController, you should use the fd_prefersNavigationBarHidden property on your view controller. This property is YES by default.
- (void)viewDidLoad {
[super viewDidLoad];
// Set to NO to show the navigation bar
self.fd_prefersNavigationBarHidden = NO;
}The ZFPlayerController is the main class used to manage playback. It supports two initialization styles: Normal style (for a single player view) and List style (for integrating with UITableView, UICollectionView, or UIScrollView).
// --- Normal style initialization ---
ZFPlayerController *player = [ZFPlayerController playerWithPlayerManager:playerManager containerView:containerView];
// OR
ZFPlayerController *player = [[ZFPlayerController alloc] initwithPlayerManager:playerManager containerView:containerView];
// --- List style initialization (for TableView, CollectionView, or ScrollView) ---
ZFPlayerController *player = [ZFPlayerController playerWithScrollView:tableView playerManager:playerManager containerViewTag:containerViewTag];
// OR
ZFPlayerController *player = [ZFPlayerController alloc] initWithScrollView:tableView playerManager:playerManager containerViewTag:containerViewTag];
// For UIScrollView specifically
ZFPlayerController *player = [ZFPlayerController playerWithScrollView:scrollView playerManager:playerManager containerView:containerView];Use MJRefreshHeader subclasses to implement drop-down (pull-down) refresh. You can initialize a header using a refreshing block or a target-action pattern.
Using a refreshing block:
self.tableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
// Call this block when entering the refresh status automatically
}];Using target-action:
self.tableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingTarget:self refreshingAction:@selector(loadNewData)];Trigger refresh manually:
[self.tableView.mj_header beginRefreshing];self.tableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
//Call this Block When enter the refresh status automatically
}];You can customize the text displayed in the refresh status using setTitle:forState:. Additionally, you can style the stateLabel to change the font and text color.
```objc
// Set title
[footer setTitle:@