mvm_core_ui/MVMCoreUI/Templates/LegacyLargeHeaderSingleLabelTemplate.swift
Pfeil, Scott Robert 81375ab196 Convert files to swift and simplify
undo top labels bottom buttons view changes
molecule delegates and spacing blocks
Primary Button Molecule
remove module name from swift files.
2019-02-13 23:16:52 -05:00

62 lines
2.5 KiB
Swift

//
// LegacyLargeHeaderSingleLabelTemplate.swift
// MVMCoreUI
//
// Created by Scott Pfeil on 2/13/19.
// Copyright © 2019 Verizon Wireless. All rights reserved.
//
import UIKit
public class LegacyLargeHeaderSingleLabelTemplate: TopLabelsAndBottomButtonsViewController {
// A label that can go below the top labels. Can be a normal label or one with internal buttons.
var labelViewUnderTopLabels: LabelView?
var labelUnderTopLabelsWithInternalButton: LabelWithInternalButton?
public override func newDataBuildScreen() {
super.newDataBuildScreen()
topLabelsView?.headlineLabel?.setFontH1(true)
topLabelsView?.separatorView?.hide()
}
public override func buildViewsBetweenLabelsAndButtons() -> [UIView]? {
var views = [UIView]()
if let labelActionMap = actionMapForLabelUnderTopLabelsWithInternalButton(), let labelUnderTopLabelsWithInternalButton = LabelWithInternalButton(actionMap: labelActionMap, additionalData: nil, actionDelegate: self) {
labelUnderTopLabelsWithInternalButton.translatesAutoresizingMaskIntoConstraints = false
labelUnderTopLabelsWithInternalButton.setAlignment(NSTextAlignment.left)
views.append(labelUnderTopLabelsWithInternalButton)
self.labelUnderTopLabelsWithInternalButton = labelUnderTopLabelsWithInternalButton
} else if let labelString = stringForLabelUnderTopLabels() {
let labelView = LabelView(frame: CGRect.zero)
labelView.translatesAutoresizingMaskIntoConstraints = false
labelView.alignLeft()
labelView.label?.styleB2(true)
labelView.label?.text = labelString
labelView.label?.setContentHuggingPriority(UILayoutPriority.required, for: NSLayoutConstraint.Axis.vertical)
views.append(labelView)
self.labelViewUnderTopLabels = labelView
}
return views;
}
public func actionMapForLabelUnderTopLabelsWithInternalButton() -> [AnyHashable : Any]? {
return loadObject?.pageJSON?.optionalDictionaryWithChainOfKeysOrIndexes([KeyButtonMap,"Link"])
}
public func stringForLabelUnderTopLabels() -> String? {
return loadObject?.pageJSON?.optionalStringForKey("description")
}
public override func spaceAboveBetweenView() -> NSNumber? {
return 0 as NSNumber
}
public override func paddingForTopLabels() -> UIEdgeInsets {
var padding = super.paddingForTopLabels()
padding.bottom = PaddingTwo
return padding
}
}