Small updates
This commit is contained in:
parent
fea104adc8
commit
527cdc684d
@ -11,50 +11,53 @@ import Foundation
|
||||
@objcMembers open class ListFourColumnDataUsageDivider: TableViewCell {
|
||||
|
||||
// MARK: - MFViewProtocol
|
||||
let label1 = Label.commonLabelB1(true)
|
||||
let label2 = Label.commonLabelB1(true)
|
||||
let label3 = Label.commonLabelB1(true)
|
||||
let label4 = Label.commonLabelB1(true)
|
||||
let stack = Stack<StackModel>(frame: .zero)
|
||||
let label1 = Label.createLabelBoldBodySmall(true)
|
||||
let label2 = Label.createLabelBoldBodySmall(true)
|
||||
let label3 = Label.createLabelBoldBodySmall(true)
|
||||
let label4 = Label.createLabelBoldBodySmall(true)
|
||||
var stack: Stack<StackModel>
|
||||
|
||||
// MARK: - Initializers
|
||||
public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
|
||||
stack = Stack<StackModel>.createStack(with: [(view: label1, model: StackItemModel(percent: 19, horizontalAlignment: .leading)),
|
||||
(view: label2, model: StackItemModel(percent: 44, horizontalAlignment: .leading)),
|
||||
(view: label3, model: StackItemModel(percent: 17, horizontalAlignment: .leading)),
|
||||
(view: label4, model: StackItemModel(percent: 20, horizontalAlignment: .leading))],
|
||||
axis: .horizontal, spacing: 8)
|
||||
super.init(style: style, reuseIdentifier: reuseIdentifier)
|
||||
}
|
||||
|
||||
public required init?(coder aDecoder: NSCoder) {
|
||||
fatalError("init(coder:) has not been implemented")
|
||||
}
|
||||
|
||||
// MARK: - MFViewProtocol
|
||||
open override func setupView() {
|
||||
super.setupView()
|
||||
stack.stackItems = [StackItem(andContain: label1),
|
||||
StackItem(andContain: label2),
|
||||
StackItem(andContain: label3),
|
||||
StackItem(andContain: label4)]
|
||||
addMolecule(stack)
|
||||
stack.restack()
|
||||
}
|
||||
|
||||
// MARK: - MVMCoreUIMoleculeViewProtocol
|
||||
open override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) {
|
||||
super.setWithModel(model, delegateObject, additionalData)
|
||||
open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) {
|
||||
super.set(with: model, delegateObject, additionalData)
|
||||
guard let model = model as? ListFourColumnDataUsageDividerModel else { return }
|
||||
label1.setWithModel(model.label1, delegateObject, additionalData)
|
||||
label2.setWithModel(model.label2, delegateObject, additionalData)
|
||||
label3.setWithModel(model.label3, delegateObject, additionalData)
|
||||
label4.setWithModel(model.label4, delegateObject, additionalData)
|
||||
//Create a stack model to use for the internal stack and set the alignment of labels
|
||||
let stackModel = StackModel(molecules: [StackItemModel(percent: 15, horizontalAlignment: .leading),
|
||||
StackItemModel(percent: 35, horizontalAlignment: .leading),
|
||||
StackItemModel(percent: 30, horizontalAlignment: .trailing),
|
||||
StackItemModel(percent: 20, horizontalAlignment: .trailing)],
|
||||
axis: .horizontal)
|
||||
stack.model = stackModel
|
||||
stack.restack()
|
||||
label1.set(with: model.label1, delegateObject, additionalData)
|
||||
label2.set(with: model.label2, delegateObject, additionalData)
|
||||
label3.set(with: model.label3, delegateObject, additionalData)
|
||||
label4.set(with: model.label4, delegateObject, additionalData)
|
||||
}
|
||||
|
||||
// MARK: - MVMCoreUIMoleculeViewProtocol
|
||||
open override func reset() {
|
||||
super.reset()
|
||||
label1.styleB1(true)
|
||||
label2.styleB1(true)
|
||||
label3.styleB1(true)
|
||||
label4.styleB1(true)
|
||||
label1.styleBoldBodySmall(true)
|
||||
label2.styleBoldBodySmall(true)
|
||||
label3.styleBoldBodySmall(true)
|
||||
label4.styleBoldBodySmall(true)
|
||||
}
|
||||
|
||||
open override class func estimatedHeight(forRow molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat {
|
||||
open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat {
|
||||
return 121
|
||||
}
|
||||
}
|
||||
|
||||
@ -21,10 +21,9 @@ public class ListFourColumnDataUsageDividerModel: ListItemModel, MoleculeModelPr
|
||||
self.label3 = label3
|
||||
self.label4 = label4
|
||||
super.init()
|
||||
setDefaults()
|
||||
}
|
||||
|
||||
// Defaults to set
|
||||
/// Defaults to set
|
||||
override public func setDefaults() {
|
||||
super.setDefaults()
|
||||
style = "tallDivider"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user