handle separator height
This commit is contained in:
parent
9d0c278a34
commit
98c481be71
|
|
@ -21,8 +21,7 @@ class MainController: UIViewController {
|
|||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
|
||||
|
||||
let a = TableRowAction<String, StoryboardImageTableViewCell>(.click) {
|
||||
(data) in
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue