OPHTableController 1.0.0

OPHTableController 1.0.0

测试已测试
语言语言 Obj-CObjective C
许可证 MIT
发布最后发布2014年12月

Ritesh维护。



  • Ritesh Gupta

下拉刷新分页(加载更多)已经成为当代iOS应用中的普遍功能。然而许多库只提供下拉刷新或分页功能,而不是两者都提供。因此,我们决定编写我们自己的自定义表格管理器,它可以处理这两个功能。现在您只需编写视图,就可以忘记实际的下拉刷新和分页细节。

OPHTableController是一个用于iOS的表格视图管理器,只需一行代码即可为您的表格视图提供下拉刷新分页功能(包括默认视图)。

self.tableController = [[OPHTableController alloc] 
     initWithScrollView:self.tableView delegate:self];

它使用了SSPullToRefresh来完成所有的下拉刷新功能。

Podfile

pod 'OPHTableController', :git => 'https://github.com/ophio/OPHTableController.git', :branch => 'master'

架构

  • OPHLoadMore
It handles all the pagination functionality.
  • SSPullToRefresh
It handles all the pull to refresh functionality.
  • OPHTablController
It manages both the above classes and your viewcontroller or another manager should only interact with this class.

如何使用它

  • 初始化方法
- (void)viewDidLoad {
   [super viewDidLoad];
     self.tableController = [[OPHTableController alloc] 
     initWithScrollView:self.tableView delegate:self];
}


  • 遵循协议
OPHTableControllerDelegate,
OPHPullToRefreshCustomView


  • OPHTableController管理器的公共方法
/* this method will by default add pull to refresh and loader into the table. */
- (instancetype)initWithScrollView:(UIScrollView*)scrollView delegate:(id<OPHTableControllerDelegate>)delegate;

/* this method can be used if you want to selectively add pull to refresh OR loader into the table. */
- (instancetype)initWithScrollView:(UIScrollView*)scrollView delegate:(id<OPHTableControllerDelegate>)delegate withPullToRefresh:(BOOL)isPullToRefresh withLoadMore:(BOOL)isLoadMore;

/* this method will stop the pull to refresh, have to call explicitly */
- (void)pullToRefreshFinishLoading;

/* this method should be called when using a custom view; you can handle the animation of the custom loader in the delegate methods */
- (void)configCustomLoadMoreView:(UIView*)customView;

/* this method should be called when using a custom pull to refresh view; you can handle the animation of the custom loader and respond to the state changes in the delegate methods */
- (void)configCustomPullToRefreshView:(UIView<OPHPullToRefreshCustomView>*)customView;


  • OPHTableControllerDelegate的代理方法
/* it should return YES if you want to use load more functionality */
- (BOOL)loadMoreShouldStartLoading:(OPHLoadMore *)loadMore;

/* you can perform API calls i.e. update data source; you should call the completion block explicitly after you have updated the data source. */
- (void)loadMoreDidStartLoading:(OPHLoadMore *)loadMore withCompletionBlock:(OPHCompletionBlock)block;

@optional
/* you can perform further actions after the loader stops */
- (void)loadMoreDidFinishLoading:(OPHLoadMore *)loadMore;

查看SSPullToRefresh的文档。


  • 自定义加载更多视图
/* this method should be called when using a custom view; you can handle the animation of the custom loader in the delegate methods */
- (void)configCustomLoadMoreView:(UIView*)customView;


贡献

在此处打开问题或发送拉取请求这里。在此处阅读贡献指南这里

许可证

OPHTableController是在MIT许可证下可用的。有关更多信息,请参阅LICENSE文件。