SelectionList 1.4.4

SelectionList 1.4.4

Yonat Sharon 维护。




  • Yonat Sharon

SelectionList

基于UITableView的简单单选或多选清单。

Swift Version Build Status License CocoaPods Compatible
Platform PRs Welcome

    

用法

let selectionList = SelectionList()
selectionList.items = ["One", "Two", "Three", "Four", "Five"]
selectionList.addTarget(self, action: #selector(selectionChanged), for: .valueChanged)
selectionList.selectedIndex = 3

多选

selectionList.allowsMultipleSelection = true
selectionList.selectedIndexes = [0, 1, 4]

更改外观

以下属性可以在 Interface Builder 或代码中更改

selectionList.selectionImage = UIImage(named: "v")
selectionList.deselectionImage = UIImage(named: "o")
selectionList.isSelectionMarkTrailing = false // to put checkmark on left side
selectionList.rowHeight = 42.0

您可以通过代码进行额外的样式化

selectionList.setupCell =  { (cell: UITableViewCell, index: Int) in
    cell.textLabel?.textColor = .gray
}

要求

  • iOS 9.0+
  • Xcode 9+

安装

CocoaPods

pod 'SelectionList'

旧版本

Swift版本 SelectionList版本
4.1 (Xcode 9.4) pod 'SelectionList', '~> 1.2.0'
4.0 pod 'SelectionList', '~> 1.0.2'

Swift Package Manager

dependencies: [
    .package(url: "https://github.com/yonat/SelectionList", from: "1.4.0")
]

Meta

@yonatsharon

https://github.com/yonat/SelectionList