GithubHelp home page GithubHelp logo

yuelin-sias / jrplaceholder Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jerrysir/jrplaceholder

0.0 2.0 0.0 527 KB

Very easy to use the tableView placeholders, zero cost to integration 设置tableVIew的placeHolder(没有数据的时候显示的图片,可以在原有代码上直接添加,无需做其他修改)

License: MIT License

Objective-C 100.00%

jrplaceholder's Introduction

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](#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/JerryLoveRice/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/JerryLoveRice/JRPlaceHolder.git

使用场景

| | -------------|-------------|------------- | | | | | | | | | | | | | | | | | | | | | | | | | | | |

Licenses

All source code is licensed under the MIT License.

jrplaceholder's People

Contributors

jerrysir avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.