介绍
TableRow和TableInlineRow是Eureka表单库的自定义行。TableRow在单元格内部使用UITableView,允许在多个选项之间进行选择。TableInlineRow是TableRow之上的InlineRow。
用法
行是通用的,因此可能存在不同的情况
import Eureka
import TableRow
class ViewController: FormViewController {
override func viewDidLoad() {
super.viewDidLoad()
form +++ Section()
<<< TableRow<Int> { row in
row.options = [1, 2, 3]
row.displayValueFor = { "\($0 ?? 0)" }
}
<<< TableInlineRow<String> { row in
row.options = ["first", second", "third"]
row.value = "none"
}
}
}
需求
- iOS 9.0+
- Xcode 11.0+
- Eureka 5.0+
安装
CocoaPods
-
将以下行添加到Podfile中
pod 'TableRow'
-
运行
$ pod install
Carthage
-
将以下行添加到您的 Cartfile
github "EurekaCommunity/TableRow"
-
运行
$ carthage update
-
在您的目标中链接
TableRow.framework
,在 Build Phases 的Copy Frameworks
脚本中将其添加到input files
列表
自定义
TableRow
textColor
- 为下层的 tableView cells 提供默认文字颜色horizontalContentInset
- 为 cells 提供内容内边距,用于区分其他行configureCell
callback - 在 cell 取消分配期间配置内部 cellonDidSelect
callback - 每次内部 cell 被选中时调用
TableInlineRow
subcellTextColor, subcellHorizontalInset
- 为 TableRow 提供相应的参数configureSubcell
callback - 为 TableRow 设置configureCell
callbackonToggleInlineRow
callback - 根据行切换状态可选地提供动作