/JRPlaceHolder

Very easy to use the tableView placeholders, zero cost to integration

Primary LanguageObjective-CMIT LicenseMIT

JRPlaceHolder

JRPlaceHolder is a CYLTableViewPlaceHolder framework inspired. Using the Functional Reactive Programming ideas, zero costs to integration, It does not affect the previous code, without modifying the code before, Integration costs can be said to be zero.

  1. Example
  2. Installation
  3. Usage scenario
  4. 中文

Example

#import <UITableView+JRTableViewPlaceHolder.h>

...

__weak __typeof(self)weakSelf = self;
[self.tableView jr_configureWithPlaceHolderBlock:^UIView * _Nonnull(UITableView * _Nonnull sender) {
  //do some things, such as pop alert view of wrong reason.
  [weakSelf.tableView setScrollEnabled:NO];
  return placeHolderView;
 } normalBlock:^(UITableView * _Nonnull sender) {
  //do some thins for recovery
  [weakSelf.tableView setScrollEnabled:YES];
}];
//Will auto check whether the data is empty in the [tableView reloadData] method.

Installation

JRPlaceHolder supports iOS 6.0+. Currently does not support the introduction of pod, you can drag the UITableView+JRTableViewPlaceHolder .H and.M file into the yours project(Currently being applied). In order to gain access to all the files from the repository, you should clone it.

git clone --recursive https://github.com/JerrySir/JRPlaceHolder.git

Usage scenario

Click here

中文

  1. 介绍
  2. 使用示例
  3. 引入方式
  4. 使用场景

介绍

JRPlaceHolder受CYLTableViewPlaceHolder框架的启发,使用响应式编程**,将方法尽可能的封装,使用起来更加的方便,既不影响之前的代码,也不用修改现在的代码,只需在所需的位置加一行代码作为配置即可,可以说是零成本集成。

使用示例

#import <UITableView+JRTableViewPlaceHolder.h>

...
__weak __typeof(self)weakSelf = self;
[self.tableView jr_configureWithPlaceHolderBlock:^UIView * _Nonnull(UITableView * _Nonnull sender) {
  //这里做一些空数据的操作,例如弹出一些提醒性的文字等
  [weakSelf.tableView setScrollEnabled:NO]; //禁止tableView滚动
  return placeHolderView; //伪代码,此处返回数据为空时的显示的view
 } normalBlock:^(UITableView * _Nonnull sender) {
  //这里做一些恢复性的操作
  [weakSelf.tableView setScrollEnabled:YES]; //恢复tableView滚动
 }];
 //程序会在[tableView reloadData]方法中自动检查是否为空。

引入方式

JRPlaceHolder 支持iOS 6.0以上的系统。 暂不支持pod方式引入(正在申请),需要引入的话可以直接将UITableView+JRTableViewPlaceHolder的.h文件和.m文件拖入到项目中。 如果需要所有的文件和演示的DEMO,可以克隆该库

git clone --recursive https://github.com/JerrySir/JRPlaceHolder.git

使用场景

加载失败场景 加载失败场景 加载失败场景
加载失败场景 加载失败场景 加载失败场景
加载失败场景 加载失败场景 加载失败场景
加载失败场景 加载失败场景 加载失败场景
加载失败场景 加载失败场景 加载失败场景
加载失败场景 加载失败场景 加载失败场景
加载失败场景 加载失败场景 加载失败场景
加载失败场景 加载失败场景 加载失败场景
加载失败场景 加载失败场景 加载失败场景
加载失败场景 加载失败场景 加载失败场景
加载失败场景 加载失败场景 加载失败场景
加载失败场景 加载失败场景 加载失败场景
加载失败场景 加载失败场景 加载失败场景
加载失败场景 加载失败场景 加载失败场景
加载失败场景 加载失败场景 加载失败场景

Licenses

All source code is licensed under the MIT License.