列表 0.4.4

列表 0.4.4

ablettx 维护。



 
依赖于
空白>= 0
MJRefresh>= 0
可达性>= 0
 

列表 0.4.4

  • 作者:
  • ablett

列表

CI Status Version License Platform

示例

这里是 Objective-C 版本 ATList

  1. 通用配置(可选,如不配置,则使用默认)
        // 列表配置(可选,如不设置,取默认)
        ListGlobalConf.share.setupConf { (conf) in
            conf.loadStyle = .all
            conf.loadStrategy = .auto
            conf.length = 20
            conf.blankData = [
                .fail : Blank(
                    type: .fail,
                    image: Blank.image(type: .fail),
                    title: "请求失败",
                    desc: "10010",
                    tap: nil
                ),
                .noData : Blank(
                    type: .noData,
                    image: Blank.image(type: .fail),
                    title: "没有数据",
                    desc: "10011",
                    tap: nil
                ),
                .noNetwork : Blank(
                    type: .noNetwork,
                    image: Blank.image(type: .fail),
                    title: "没有网络",
                    desc: "10012",
                    tap: nil)
            ];
            conf.loadHeaderStyle = .gif
        }
  1. 在具体页面中使用
        // 具体列表配置(可选,如不设置,则取 ListGlobalConf,ListGlobalConf 未设置时取 conf)
        tableView.updateListConf { (conf) in
            conf.loadStrategy = self.loadStrategy
            conf.loadStyle = self.loadStyle
            conf.length = 20
            conf.blankData = [
                .fail : Blank(
                    type: .fail,
                    image: Blank.image(type: .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)
            })
        }

要运行示例项目,请克隆存储库,然后从 Example 目录中首先运行 pod install

需求

安装

列表通过 CocoaPods 提供。要安装它,只需将以下行添加到您的 Podfile 中

pod 'List'

作者

ablett, [email protected]

许可证

列表可在MIT许可证下获取。有关更多信息,请参阅LICENSE文件。