WMPageController-JQHover 0.1.0

WMPageController-JQHover 0.1.0

coder zjq 维护。




  • 作者
  • coder-zjq

JQHoverPage

CI Status Version License Platform

示例

要运行示例项目,请先克隆仓库,然后从 Example 目录运行 pod install

Example

要求

iOS 8.0 +

安装

JQHoverPage 可通过 CocoaPods 获得。要安装它,只需将以下行添加到您的 Podfile 中

pod 'JQHoverPage'

使用方法

使用 WMPageController(点击查看更多细节)

主页

#import "WMPageController+JQPage.h"

@interface JQDemoPageController : WMPageController

@end

@implementation JQDemoPageController

- (void)viewDidLoad {
[super viewDidLoad];
self.menuView.backgroundColor = [UIColor colorWithWhite:.9f alpha:1.f];
}

// the view controller should confirm the JQSubpageControllerDelegate protocol
- (UIViewController<JQSubpageControllerDelegate> *)pageController:(WMPageController *)pageController viewControllerAtIndex:(NSInteger)index {
JQDemoSubpageController *vc = [[JQDemoSubpageController alloc] init];
return vc;
}

子页面

#import <UIKit/UIKit.h>
#import "WMPageController+JQPage.h"
// subpage view controller should confirm the JQSubpageControllerDelegate protocol
@interface JQDemoSubpageController : UITableViewController <JQSubpageControllerDelegate>

@end


@implementation JQDemoSubpageController

#pragma mark -
#pragma mark - JQSubpageControllerDelegate

// implementation JQSubpageControllerDelegate protocol, return the subpage scrollView.
- (UIScrollView *)scrollView {
return self.tableView;
}

将页面添加到 UITableView / UICollectionView / UIScrollView

UITableView

// 1. init the hover footer view page
CGFloat height = [UIScreen mainScreen].bounds.size.height - CGRectGetHeight([UIApplication sharedApplication].statusBarFrame) - CGRectGetHeight(self.navigationController.navigationBar.frame);
JQHoverFooterView *footerView = [[JQHoverFooterView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width,  height)];

// 2. init the page and add the page to current controller's child view controller
JQDemoPageController *page = [[JQDemoPageController alloc] init];
[self addChildViewController:page];

// 3. set the page to hover footer view, set the jq_hoverFooter to tableView
footerView.page = page;
self.tableView.jq_hoverFooter = footerView;

UICollectionView

// 1. init the hover footer view page
CGFloat height = [UIScreen mainScreen].bounds.size.height - CGRectGetHeight([UIApplication sharedApplication].statusBarFrame) - CGRectGetHeight(self.navigationController.navigationBar.frame);
JQHoverFooterView *footerView = [[JQHoverFooterView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width,  height)];

// 2. init the page and add the page to current controller's child view controller
JQDemoPageController *page = [[JQDemoPageController alloc] init];
[self addChildViewController:page];

// 3. set the page to hover footer view, set the jq_hoverFooter to collectionView
footerView.page = page;
self.collectionView.jq_hoverFooter = footerView;

UIScrollView

// 1. init the hover footer view page
CGFloat height = [UIScreen mainScreen].bounds.size.height - CGRectGetHeight([UIApplication sharedApplication].statusBarFrame) - CGRectGetHeight(self.navigationController.navigationBar.frame);
JQHoverFooterView *footerView = [[JQHoverFooterView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width,  height)];

// 2. init the page and add the page to current controller's child view controller
JQDemoPageController *page = [[JQDemoPageController alloc] init];
[self addChildViewController:page];

// 3. set the page to hover footer view, set the jq_hoverFooter to collectionView
footerView.page = page;
self.scrollView.jq_hoverFooter = footerView;

(更多细节见示例项目)

致谢

WMPageController:提供页面实现。

MJRefresh:提供本项目的灵感。

作者

coder-zjq, [email protected]

许可

JQHoverPage 采用 MIT 许可证。更多详情请参阅 LICENSE 文件。