欢迎使用 AwesomeExpandedTable
示例
- 要运行示例项目,请先克隆仓库,并从 Example 目录执行
pod install
。
要求
- iOS 10.0+
- Xcode 9.2+
- Swift 4.1+
安装
AwesomeExpandedTable 可通过 CocoaPods 获得。要安装,只需将以下行添加到您的 Podfile 中:
pod 'AwesomeExpandedTable'
交流
- 如果您发现了一个错误,请打开一个问题和。
- 如果您有一个功能请求,请打开一个问题和。
- 如果您想贡献,请提交一个。
安装
只需将 "Expand Table" 文件夹拖放到您的项目中即可。
使用方法
要使用,您可以添加 "ExpandTableView" 作为 "UITableView" 的子类到您的Storyboard中,或者直接在代码中使用。您可以自定义 "ExpandTableCell",按您的喜好和需要。
"ExpandTableView" 使用 "ExpandModel" 模型,因此您无法按需要更新它。*
**可以使用示例:**
您可以下载它,或者按照以下步骤进行
- 首先,您需要生成表格值,如下所示
func generateTestValue() -> [String:Any] { var parentValue:[String:Any] = [:] parentValue = [ // root value /// not show in app "name":"Value", "parent_id": 0, "category_id":0, "categories": // first drop [["name":"Value1", "parent_id": 1, "category_id":1, "categories": // second [["name":"Value1 child1", "category_id":2, "parent_id":1, "categories":[ //third ["name":"Value1 child1 child1", "category_id":2, "parent_id":1], ["name":"Value1 child1 child2", "category_id":2, "parent_id":1], ["name":"Value1 child1 child3", "category_id":2, "parent_id":2]]], ["name":"Value1 child2", "category_id":3, "parent_id":1]]], // first ["name":"Value2", "category_id":5, "parent_id":2, "categories": // second [["name":"Value2 child1", "category_id":6, "parent_id":2], ["name":"Value2 child2", "category_id":7, "parent_id":2, "categories":[ //third ["name":"Value2 child2 chidl1", "category_id":6, "parent_id":2], ["name":"Value2 child2 chidl2", "category_id":6, "parent_id":2, "categories":[ //four ["name":"Value2 child2 chidl2 child 1", "category_id":2, "parent_id":2], ["name":"Value2 child2 chidl2 child 2", "category_id":2, "parent_id":2], ["name":"Value2 child2 chidl2 child 3", "category_id":2, "parent_id":2]]], ["name":"Value2 child3", "category_id":6, "parent_id":2]]], ["name":"Value2 child3", "category_id":7, "parent_id":2]]] ]] return parentValue }
- 然后,初始化ExpandTableView
let table = ExpandTableView.init(generateTestValue(), rowHeight: 40, font: UIFont.systemFont(ofSize: 16), textColor: .gray, hide: false, isArrowFromLeft: false, imagesArray:[UIImage(named: "sU")!, UIImage(named: "sD")!])
-
您可以下载示例应用程序并查看它是如何工作的。
-
放松并享受这个出色的表视图
作者
Olegek Legek,MOVA.io,[email protected]