implement custom cell height action
This commit is contained in:
parent
da51e2b7e9
commit
2e8b3f3232
|
|
@ -30,8 +30,6 @@ class MainController: UIViewController {
|
|||
case 0:
|
||||
self?.performSegueWithIdentifier("autolayoutcells", sender: nil)
|
||||
case 1:
|
||||
self?.performSegueWithIdentifier("rowbuildercells", sender: nil)
|
||||
case 2:
|
||||
self?.performSegueWithIdentifier("nibcells", sender: nil)
|
||||
default:
|
||||
break
|
||||
|
|
@ -41,7 +39,6 @@ class MainController: UIViewController {
|
|||
let rows: [Row] = [
|
||||
|
||||
TableRow<String, ConfigurableTableViewCell>(item: "Autolayout cells", actions: [clickAction]),
|
||||
TableRow<String, ConfigurableTableViewCell>(item: "Row builder cells", actions: [clickAction]),
|
||||
TableRow<String, ConfigurableTableViewCell>(item: "Nib cells", actions: [clickAction])
|
||||
]
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ class NibCellsController: UITableViewController {
|
|||
let shouldHighlightAction = TableRowAction<Int, NibTableViewCell>(.shouldHighlight) { (_) -> Bool in
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
let rows: [Row] = numbers.map { TableRow<Int, NibTableViewCell>(item: $0, actions: [shouldHighlightAction]) }
|
||||
|
||||
tableDirector.append(rows: rows)
|
||||
|
|
|
|||
|
|
@ -119,7 +119,9 @@ public class TableDirector: NSObject, UITableViewDataSource, UITableViewDelegate
|
|||
public func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
|
||||
|
||||
let row = sections[indexPath.section].items[indexPath.row]
|
||||
return heightStrategy?.height(row, path: indexPath) ?? row.defaultHeight
|
||||
let rowHeight = invoke(action: .height, cell: nil, indexPath: indexPath) as? CGFloat
|
||||
|
||||
return rowHeight ?? heightStrategy?.height(row, path: indexPath) ?? row.defaultHeight
|
||||
}
|
||||
|
||||
// MARK: UITableViewDataSource - configuration
|
||||
|
|
|
|||
Loading…
Reference in New Issue