mirror of
https://github.com/ReactiveX/RxSwift.git
synced 2024-10-05 22:47:15 +03:00
make title setting a bit simpler
This commit is contained in:
parent
8685a404ee
commit
6f3544da55
@ -47,6 +47,10 @@ class SimpleTableViewExampleSectionedViewController
|
||||
cell.textLabel?.text = "\(element) @ row \(indexPath.row)"
|
||||
return cell
|
||||
}
|
||||
|
||||
dataSource.titleForHeaderInSection = { dataSource, sectionIndex in
|
||||
return dataSource[sectionIndex].model
|
||||
}
|
||||
|
||||
items
|
||||
.bindTo(tableView.rx.items(dataSource: dataSource))
|
||||
@ -67,12 +71,6 @@ class SimpleTableViewExampleSectionedViewController
|
||||
.disposed(by: disposeBag)
|
||||
}
|
||||
|
||||
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
|
||||
let label = UILabel(frame: CGRect.zero)
|
||||
label.text = dataSource[section].model
|
||||
return label
|
||||
}
|
||||
|
||||
// to prevent swipe to delete behavior
|
||||
func tableView(_ tableView: UITableView, editingStyleForRowAt indexPath: IndexPath) -> UITableViewCellEditingStyle {
|
||||
return .none
|
||||
|
Loading…
Reference in New Issue
Block a user