Giter VIP home page Giter VIP logo

emptyviewdemo's Introduction

EmptyViewDemo

列表没有数据的时候显示自定义View提示。适用于UITableView、UICollectionView。
同时需要第三方库pod 'Aspects'。

截图

使用方法

1导入两个文件

UIScrollView+CLEmptyView.h和UIScrollView+CLEmptyView.m

2引用包含头文件

#import "UIScrollView+CLEmptyView.h"

3设置代理CLEmptyDataSource

self.tableView.emptyDataSource = self;

4实现代理方法

#pragma mark - CLEmptyDataSource
/**
 空数据时UI设置回调
 
 @param scrollView 对象
 @return 需要展示的UI
 */
- (UIView *)cl_emptyViewDataSource:(UIScrollView *)scrollView {
    //这里想显示什么都可以自己写,量多的话,就考虑自己写个基类或封装
    CLEmtpyView *view = [[CLEmtpyView alloc]init];
    view.actionBlock = ^(UIButton *sender) {
        NSLog(@"点击事件");
    };
    return view;
}

/**
 空数据UI偏移设置回调
 
 @param scrollView 对象
 @return 偏移量
 */
- (CGPoint)cl_emptyViewOffset:(UIScrollView *)scrollView {
    return CGPointMake(0, 0);
}

emptyviewdemo's People

Contributors

carrysniper avatar

Stargazers

bruce.liu avatar

Watchers

James Cloos 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.