add isPrototype property
This commit is contained in:
parent
98c481be71
commit
a2f8bdde30
|
|
@ -17,7 +17,7 @@ class StoryboardImageTableViewCell: UITableViewCell, ConfigurableCell {
|
|||
@IBOutlet var subtitleLabel: UILabel!
|
||||
@IBOutlet var customImageView: UIImageView!
|
||||
|
||||
func configure(string: T) {
|
||||
func configure(string: T, isPrototype: Bool) {
|
||||
|
||||
titleLabel.text = string
|
||||
subtitleLabel.text = "Copyright © 2016 Tablet. All rights reserved.Copyright © 2016 Tablet. All rights reserved.Copyright © 2016 Tablet. All rights reserved.Copyright © 2016 Tablet. All rights reserved.Copyright © 2016 Tablet. All rights reserved.Copyright © 2016 Tablet. All rights reserved.Copyright © 2016 Tablet. All rights reserved.Copyright © 2016 Tablet. All rights reserved.Copyright © 2016 Tablet. All rights reserved.Copyright © 2016 Tablet. All rights reserved.Copyright © 2016 Tablet. All rights reserved.1"
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ class StoryboardTableViewCell: UITableViewCell, ConfigurableCell {
|
|||
|
||||
typealias T = String
|
||||
|
||||
func configure(value: T) {
|
||||
func configure(value: T, isPrototype: Bool) {
|
||||
textLabel?.text = value
|
||||
}
|
||||
}
|
||||
|
|
@ -27,7 +27,7 @@ public protocol ConfigurableCell {
|
|||
static func reusableIdentifier() -> String
|
||||
static func estimatedHeight() -> CGFloat
|
||||
static func defaultHeight() -> CGFloat?
|
||||
func configure(_: T)
|
||||
func configure(_: T, isPrototype: Bool)
|
||||
}
|
||||
|
||||
public extension ConfigurableCell where Self: UITableViewCell {
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ public class PrototypeHeightStrategy: CellHeightCalculatable {
|
|||
|
||||
cell.bounds = CGRectMake(0, 0, tableView?.bounds.size.width ?? 0, cell.bounds.height)
|
||||
|
||||
row.configure(cell)
|
||||
row.configure(cell, isPrototype: true)
|
||||
|
||||
cell.setNeedsLayout()
|
||||
cell.layoutIfNeeded()
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ public class TableDirector: NSObject, UITableViewDataSource, UITableViewDelegate
|
|||
cell.layoutIfNeeded()
|
||||
}
|
||||
|
||||
row.configure(cell)
|
||||
row.configure(cell, isPrototype: false)
|
||||
|
||||
return cell
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ import UIKit
|
|||
|
||||
public protocol RowConfigurable {
|
||||
|
||||
func configure(cell: UITableViewCell)
|
||||
func configure(cell: UITableViewCell, isPrototype: Bool)
|
||||
}
|
||||
|
||||
public protocol RowActionable {
|
||||
|
|
@ -72,8 +72,8 @@ public class TableRow<ItemType, CellType: ConfigurableCell where CellType.T == I
|
|||
|
||||
// MARK: - RowConfigurable -
|
||||
|
||||
public func configure(cell: UITableViewCell) {
|
||||
(cell as? CellType)?.configure(item)
|
||||
public func configure(cell: UITableViewCell, isPrototype: Bool) {
|
||||
(cell as? CellType)?.configure(item, isPrototype: isPrototype)
|
||||
}
|
||||
|
||||
// MARK: - RowActionable -
|
||||
|
|
|
|||
Loading…
Reference in New Issue