height fixes
This commit is contained in:
parent
15a943d2e7
commit
b80cd421cf
@ -333,6 +333,7 @@ public typealias ActionBlockConfirmation = () -> (Bool)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MARK:- ModelMoleculeViewProtocol
|
||||||
public override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
public override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||||
guard let toggleModel = model as? ToggleModel else {
|
guard let toggleModel = model as? ToggleModel else {
|
||||||
return
|
return
|
||||||
@ -341,6 +342,10 @@ public typealias ActionBlockConfirmation = () -> (Bool)
|
|||||||
let toggleModelJSON = toggleModel.toJSON()
|
let toggleModelJSON = toggleModel.toJSON()
|
||||||
setWithJSON(toggleModelJSON, delegateObject: delegateObject, additionalData: additionalData)
|
setWithJSON(toggleModelJSON, delegateObject: delegateObject, additionalData: additionalData)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override class func estimatedHeight(forRow molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||||
|
return Self.getContainerHeight()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - Accessibility
|
// MARK: - Accessibility
|
||||||
|
|||||||
@ -34,9 +34,7 @@ import UIKit
|
|||||||
NSLayoutConstraint.pinSubviewsCenter(leftView: headlineBody, rightView: toggle)
|
NSLayoutConstraint.pinSubviewsCenter(leftView: headlineBody, rightView: toggle)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MARK:- ModelMoleculeViewProtocol
|
||||||
//MARK: - MVMCoreMoleculeViewProtocol
|
|
||||||
|
|
||||||
open override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
open override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||||
super.setWithModel(model, delegateObject, additionalData)
|
super.setWithModel(model, delegateObject, additionalData)
|
||||||
guard let headlineBodyToggleModel = model as? HeadlineBodyToggleModel else {
|
guard let headlineBodyToggleModel = model as? HeadlineBodyToggleModel else {
|
||||||
@ -46,31 +44,17 @@ import UIKit
|
|||||||
}
|
}
|
||||||
|
|
||||||
public class override func estimatedHeight(forRow molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
public class override func estimatedHeight(forRow molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||||
return 30
|
guard let model = molecule as? HeadlineBodyToggleModel,
|
||||||
|
let toggleHeight = Toggle.estimatedHeight(forRow: model.toggle, delegateObject: delegateObject),
|
||||||
|
let headlineBody = HeadlineBody.estimatedHeight(forRow: model.headlineBody, delegateObject: delegateObject) else { return nil }
|
||||||
|
return max(toggleHeight, headlineBody)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// MARK: - MVMCoreUIMoleculeViewProtocol
|
// MARK: - MVMCoreUIMoleculeViewProtocol
|
||||||
open override func setWithJSON(_ json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable : Any]?) {
|
|
||||||
super.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData)
|
|
||||||
headlineBody.setWithJSON(json?.optionalDictionaryForKey("headlineBody"), delegateObject: delegateObject, additionalData: additionalData)
|
|
||||||
toggle.setWithJSON(json?.optionalDictionaryForKey("toggle"), delegateObject: delegateObject, additionalData: additionalData)
|
|
||||||
}
|
|
||||||
|
|
||||||
open class func estimatedHeight(forRow json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat {
|
|
||||||
return 30
|
|
||||||
}
|
|
||||||
|
|
||||||
open override func setAsMolecule() {
|
|
||||||
headlineBody.setAsMolecule()
|
|
||||||
(toggle as MVMCoreUIMoleculeViewProtocol).setAsMolecule?()
|
|
||||||
headlineBody.styleListItem()
|
|
||||||
}
|
|
||||||
|
|
||||||
open override func reset() {
|
open override func reset() {
|
||||||
super.reset()
|
super.reset()
|
||||||
headlineBody.reset()
|
headlineBody.reset()
|
||||||
(toggle as MVMCoreUIMoleculeViewProtocol).reset?()
|
toggle.reset()
|
||||||
headlineBody.styleListItem()
|
headlineBody.styleListItem()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
|
|
||||||
@objcMembers public class LabelSwitch: ViewConstrainingView, ModelMoleculeViewProtocol {
|
@objcMembers public class LabelSwitch: View {
|
||||||
let label = Label.commonLabelB1(true)
|
let label = Label.commonLabelB1(true)
|
||||||
let mvmSwitch = Toggle()
|
let mvmSwitch = Toggle()
|
||||||
|
|
||||||
@ -24,24 +24,22 @@ import UIKit
|
|||||||
guard mvmSwitch.superview == nil else {
|
guard mvmSwitch.superview == nil else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
let view = MVMCoreUICommonViewsUtility.commonView()
|
|
||||||
addSubview(view)
|
|
||||||
pinView(toSuperView: view)
|
|
||||||
|
|
||||||
view.addSubview(label)
|
addSubview(label)
|
||||||
view.addSubview(mvmSwitch)
|
addSubview(mvmSwitch)
|
||||||
label.setContentHuggingPriority(UILayoutPriority.required, for: NSLayoutConstraint.Axis.vertical)
|
label.setContentHuggingPriority(UILayoutPriority.required, for: NSLayoutConstraint.Axis.vertical)
|
||||||
NSLayoutConstraint.pinSubviewsCenter(leftView: label, rightView: mvmSwitch)
|
NSLayoutConstraint.pinSubviewsCenter(leftView: label, rightView: mvmSwitch)
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - MVMCoreUIMoleculeViewProtocol
|
// MARK:- ModelMoleculeViewProtocol
|
||||||
public override func setWithJSON(_ json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable : Any]?) {
|
public override class func estimatedHeight(forRow molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||||
super.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData)
|
guard let model = molecule as? LabelToggleModel,
|
||||||
label.setWithJSON(json?.optionalDictionaryForKey("label"), delegateObject: delegateObject, additionalData: additionalData)
|
let toggleHeight = Toggle.estimatedHeight(forRow: model.toggle, delegateObject: delegateObject),
|
||||||
mvmSwitch.setWithJSON(json?.optionalDictionaryForKey("toggle"), delegateObject: delegateObject, additionalData: additionalData)
|
let labelHeight = Label.estimatedHeight(forRow: model.label, delegateObject: delegateObject) else { return nil }
|
||||||
|
return max(toggleHeight, labelHeight)
|
||||||
}
|
}
|
||||||
|
|
||||||
public func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
public override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||||
guard let labelToggleModel = model as? LabelToggleModel else {
|
guard let labelToggleModel = model as? LabelToggleModel else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -49,17 +47,7 @@ import UIKit
|
|||||||
mvmSwitch.setWithModel(labelToggleModel.toggle, delegateObject, additionalData)
|
mvmSwitch.setWithModel(labelToggleModel.toggle, delegateObject, additionalData)
|
||||||
}
|
}
|
||||||
|
|
||||||
public override class func estimatedHeight(forRow json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat {
|
// MARK: - MVMCoreUIMoleculeViewProtocol
|
||||||
return MVMCoreUISwitch.estimatedHeight(forRow: json, delegateObject: delegateObject)
|
|
||||||
}
|
|
||||||
|
|
||||||
public override func setAsMolecule() {
|
|
||||||
super.setAsMolecule()
|
|
||||||
label.setAsMolecule()
|
|
||||||
(mvmSwitch as MVMCoreUIMoleculeViewProtocol).setAsMolecule?()
|
|
||||||
label.styleB1(true)
|
|
||||||
}
|
|
||||||
|
|
||||||
public override func reset() {
|
public override func reset() {
|
||||||
super.reset()
|
super.reset()
|
||||||
label.reset()
|
label.reset()
|
||||||
|
|||||||
@ -119,6 +119,11 @@ open class HeadlineBody: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MARK:- ModelMoleculeViewProtocol
|
||||||
|
public override class func estimatedHeight(forRow molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||||
|
return 58
|
||||||
|
}
|
||||||
|
|
||||||
public override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
public override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||||
|
|
||||||
super.setWithModel(model, delegateObject, additionalData)
|
super.setWithModel(model, delegateObject, additionalData)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user