diff --git a/Demo/Classes/Presentation/Controllers/MainController.swift b/Demo/Classes/Presentation/Controllers/MainController.swift index 4cc8203..e8812d1 100644 --- a/Demo/Classes/Presentation/Controllers/MainController.swift +++ b/Demo/Classes/Presentation/Controllers/MainController.swift @@ -21,8 +21,7 @@ class MainController: UIViewController { override func viewDidLoad() { super.viewDidLoad() - - + let a = TableRowAction(.click) { (data) in diff --git a/README.md b/README.md index 170adf3..0f02666 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ It hides a complexity of `UITableViewDataSource` and `UITableViewDelegate` metho - [x] Correctly handles autolayout cells with multiline labels - [x] Chainable cell actions (select/deselect etc.) - [x] Support cells created from code, xib, or storyboard -- [x] Automatic xib/classes registration +- [x] Support different cells height calculation strategies - [x] No need to subclass - [x] Extensibility diff --git a/Sources/HeightStrategy.swift b/Sources/HeightStrategy.swift index 469542e..43243ff 100644 --- a/Sources/HeightStrategy.swift +++ b/Sources/HeightStrategy.swift @@ -32,6 +32,7 @@ public class PrototypeHeightStrategy: CellHeightCalculatable { public weak var tableView: UITableView? private var cachedHeights = [Int: CGFloat]() + private var separatorHeight = 1 / UIScreen.mainScreen().scale init(tableView: UITableView?) { self.tableView = tableView @@ -51,8 +52,8 @@ public class PrototypeHeightStrategy: CellHeightCalculatable { cell.setNeedsLayout() cell.layoutIfNeeded() - - let height = cell.contentView.systemLayoutSizeFittingSize(UILayoutFittingCompressedSize).height + 1 + + let height = cell.contentView.systemLayoutSizeFittingSize(UILayoutFittingCompressedSize).height + (tableView?.separatorStyle != .None ? separatorHeight : 0) cachedHeights[row.hashValue] = height