handle separator height

This commit is contained in:
Max Sokolov 2016-06-15 01:21:12 +03:00
parent 9d0c278a34
commit 98c481be71
3 changed files with 5 additions and 5 deletions

View File

@ -21,8 +21,7 @@ class MainController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
let a = TableRowAction<String, StoryboardImageTableViewCell>(.click) {
(data) in

View File

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

View File

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