make title setting a bit simpler

This commit is contained in:
gaopin 2017-03-03 13:38:56 +09:00 committed by Krunoslav Zaher
parent 8685a404ee
commit 6f3544da55

View File

@ -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