mvm_core_ui/MVMCoreUI/Molecules/StandardFooterView.swift
Pfeil, Scott Robert 8400c0eae8 name change
2019-07-19 10:53:16 -04:00

34 lines
1.4 KiB
Swift

//
// StandardFooterView.swift
// MVMCoreUI
//
// Created by Scott Pfeil on 3/11/19.
// Copyright © 2019 Verizon Wireless. All rights reserved.
//
import UIKit
open class StandardFooterView: ViewConstrainingView {
open override func setupView() {
super.setupView()
shouldSetupMoleculeFromJSON = true
updateViewVerticalDefaults = true
updateViewHorizontalDefaults = true
}
open override func setWithJSON(_ json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable : Any]?) {
super.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData)
// This molecule will by default handle margins.
(molecule as? MVMCoreUIViewConstrainingProtocol)?.shouldSetHorizontalMargins?(false)
(molecule as? MVMCoreUIViewConstrainingProtocol)?.shouldSetVerticalMargins?(false)
}
public override static func estimatedHeight(forRow json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat {
if let moleculeJSON = json?.optionalDictionaryForKey(KeyMolecule), let height = MVMCoreUIMoleculeMappingObject.shared()?.getMoleculeClass(withJSON: moleculeJSON)?.estimatedHeight?(forRow: moleculeJSON, delegateObject: delegateObject) {
return height + PaddingDefaultVerticalSpacing + PaddingDefaultVerticalSpacing
}
return 42
}
}