PrototypeHeightStrategy improvements
This commit is contained in:
parent
70d6cb8d73
commit
1be65d18ad
|
|
@ -49,7 +49,14 @@ public class PrototypeHeightStrategy: CellHeightCalculatable {
|
|||
return height
|
||||
}
|
||||
|
||||
guard let cell = tableView.dequeueReusableCellWithIdentifier(row.reuseIdentifier) else { return 0 }
|
||||
var prototypeCell = prototypes[row.reuseIdentifier]
|
||||
if prototypeCell == nil {
|
||||
|
||||
prototypeCell = tableView.dequeueReusableCellWithIdentifier(row.reuseIdentifier)
|
||||
prototypes[row.reuseIdentifier] = prototypeCell
|
||||
}
|
||||
|
||||
guard let cell = prototypeCell else { return 0 }
|
||||
|
||||
cell.bounds = CGRectMake(0, 0, tableView.bounds.size.width, cell.bounds.height)
|
||||
|
||||
|
|
@ -66,7 +73,11 @@ public class PrototypeHeightStrategy: CellHeightCalculatable {
|
|||
}
|
||||
|
||||
public func estimatedHeight(row: Row, path: NSIndexPath) -> CGFloat {
|
||||
return UITableViewAutomaticDimension
|
||||
|
||||
if let estimatedHeight = row.estimatedHeight where estimatedHeight > 0 {
|
||||
return estimatedHeight
|
||||
}
|
||||
return height(row, path: path)
|
||||
}
|
||||
|
||||
public func invalidate() {
|
||||
|
|
|
|||
Loading…
Reference in New Issue