GithubHelp home page GithubHelp logo

zniel / gzwtableviewloading Goto Github PK

View Code? Open in Web Editor NEW

This project forked from q351941406/gzwscrollviewextension

0.0 2.0 0.0 80 KB

这是一个UITableView的分类,一行代码解决加载数据中状态和没有数据下的状态

License: MIT License

Ruby 1.59% Objective-C 98.41%

gzwtableviewloading's Introduction

GzwTableViewLoading

这是我用脚写出来的运行时框架,一行代码解决UITableView加载状态和所有空数据状态

样式支持全自定义

enter image description here enter image description here enter image description here

导入框架

把工程内的 GzwTableViewLoading 文件夹拖入自己的工程

引用 #import "GzwTableViewLoading.h"

现已加入CocoaPods豪华午餐:pod 'GzwTableViewLoading', '~> 1.1.0'

使用

// 在请求数据前
self.tableView.loading = YES;

用法示例(详情看demo)

// 只需一行代码,我来解放你的代码
self.tableView.loading = YES;

// 模拟延迟
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
    if (data) {
        for (int i = 0; i < 10; i++) {
            [self.data addObject:[NSString stringWithFormat:@"I'm data,fuck!"]];
        }
    }else {// 无数据时
        self.tableView.loading = NO;
    }
    [self.tableView reloadData];
});

配置参数(自定义)

self.tableView.buttonText = @"再次请求";
self.tableView.buttonNormalColor = [UIColor redColor];
self.tableView.buttonHighlightColor = [UIColor yellowColor];
self.tableView.loadedImageName = @"58x58";
self.tableView.descriptionText = @"破网络,你还是再请求一次吧";
self.tableView.dataVerticalOffset = 200;  

框架的故事:

当我把项目完成了,产品经理说要改掉所有页面的加载样式,这时候我是崩溃的,于是去找第三方库,找到了一个可用的库
但需要对每个UITableVIew操作,(用继承?滚一边反省去), 这都导致了强耦合,于是我用运行时,不对,我用脚封装了这个库,一行代码就搞定了,真正的低耦合

关于我

QQ 351941406 有问题,你们是加不了的。

QQ群:180972893 可以加

希望你们在使用框架的过程中联系我,提供更多宝贵的意见,一起把框架维护好。

gzwtableviewloading's People

Contributors

q351941406 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.