Code Monkey home page Code Monkey logo

djemptyview's Introduction

DJEmptyView

Add an empty view to your table view with one line of codes.

Main Features!

  • Add an empty view to a table view or a view.

How To Install?

Manual

Just drag the DJEmptyView folder to your project.

Cocoapods

pod 'DJEmptyView'

You should also import this framework before you use it, like this import DJEmptyView.

How to use DJEmptyView?

It's very simple. only one function you should update. In your loadData function, you can just do this.

private func loadData() {
        
    MyService.request(target: .dataList, success: { (res) -> (Void) in
        // empty view start.
        if dataArray.count == 0 {
            self.tableView.reloadData()
            self.tableView.dj_showEmptyView(DJEmptyView(tipInfo: "no data", imageName: "img_no_data"))
            return
        }
            
        self.tableView.dj_hideEmptyView()
        // empty view end.
        
        // more codes
    })
}

How to pull to refresh in empty view?

You do not need add any codes to support this function. You can just drag down the empty view.

Tips: You should add below codes to your table view, otherwise there will be lines in the empty view.

tableView.separatorStyle = .none

Note:

You can download the demo for example codes.

License

MIT

Contact Me

悟饭哪

Thanks

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.