Skip to content

ablettchen/List

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

List

CI Status Version License Platform

Example

Objective-C 版本在这里 ATList

  1. 通用配置(可选,如不配置,则使用默认)
        // 列表配置(可选,如不设置,取默认)
        ListGlobalConf.share.setupConf { (conf) in
            conf.loadComponent = .all
            conf.loadMode = .auto
            conf.length = 20
            conf.blankData = [
                .fail : Blank(
                    type: .fail,
                    image: Blank.image(.fail),
                    title: "请求失败",
                    desc: "10010",
                    tap: nil
                ),
                .noData : Blank(
                    type: .noData,
                    image: Blank.image(.fail),
                    title: "没有数据",
                    desc: "10011",
                    tap: nil
                ),
                .noNetwork : Blank(
                    type: .noNetwork,
                    image: Blank.image(.fail),
                    title: "没有网络",
                    desc: "10012",
                    tap: nil)
            ];
            conf.loadHeaderStyle = .gif
        }
  1. 具体页面中使用
        // 具体列表配置(可选,如不设置,则取 ListGlobalConf,ListGlobalConf 未设置时取 conf)
        tableView.updateListConf { (conf) in
            conf.loadMode = self.loadMode
            conf.loadComponent = self.loadComponent
            conf.length = 20
            conf.blankData = [
                .fail : Blank(
                    type: .fail,
                    image: Blank.image(.fail),
                    title: "绘本数据加载失败",
                    desc: "10015",
                    tap: nil
                )
            ];
        }
        
        // 加载数据
        tableView.loadListData { (list) in
            self.requestData(["offset" : list.range.location, "number" : list.range.length], { (error, models) in
                if list.loadStatus == .new {self.datas.removeAll()}
                if models != nil {self.datas += models!}
                list.finish(error: error)
            })
        }

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

Installation

List is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'List'

Author

ablett, ablettchen@gmail.com

License

List is available under the MIT license. See the LICENSE file for more info.

About

Quick configuration pull-down refresh, pull-up loading, blank page, for UITableView, UICollectionView, UIScrollView.

Resources

License

Stars

Watchers

Forks

Packages

No packages published