Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/iwufan/djemptyview
Add an empty view to your table view with one line of codes.
https://github.com/iwufan/djemptyview
empty-view ios no-network nodata swift swift4 uitableview
Last synced: 25 days ago
JSON representation
Add an empty view to your table view with one line of codes.
- Host: GitHub
- URL: https://github.com/iwufan/djemptyview
- Owner: iwufan
- License: mit
- Created: 2018-12-19T14:06:29.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2019-09-26T07:47:40.000Z (about 5 years ago)
- Last Synced: 2024-10-09T16:31:20.779Z (about 1 month ago)
- Topics: empty-view, ios, no-network, nodata, swift, swift4, uitableview
- Language: Swift
- Size: 89.8 KB
- Stars: 5
- Watchers: 3
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# DJEmptyView
Add an empty view to your table view with one line of codes.![](https://github.com/iwufan/Resources/blob/master/Images/DJEmptyView/example1.gif)
![](https://github.com/iwufan/Resources/blob/master/Images/DJEmptyView/example2.gif)
![](https://github.com/iwufan/Resources/blob/master/Images/DJEmptyView/example3.gif)### 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
[悟饭哪](https://www.jianshu.com/u/819830158b47)#### Thanks