Added standardlistitem.

This commit is contained in:
Kevin G Christiano 2019-06-24 10:48:28 -04:00
parent cd577288c3
commit ba84d2780d
2 changed files with 150 additions and 0 deletions

View File

@ -18,6 +18,7 @@
01DF55E021F8FAA800CC099B /* MFTextFieldListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01DF55DF21F8FAA800CC099B /* MFTextFieldListView.swift */; };
01DF567021FA5AB300CC099B /* TextFieldListFormViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01DF566F21FA5AB300CC099B /* TextFieldListFormViewController.swift */; };
01E569D3223FFFA500327251 /* ThreeLayerViewController.swift in Headers */ = {isa = PBXBuildFile; fileRef = D2A5146A2214905000345BFB /* ThreeLayerViewController.swift */; settings = {ATTRIBUTES = (Public, ); }; };
0A1214A022C11A18007C7030 /* StandardListItemWithImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A12149F22C11A17007C7030 /* StandardListItemWithImage.swift */; };
B8200E152280C4CF007245F4 /* ProgressBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8200E142280C4CF007245F4 /* ProgressBar.swift */; };
B8200E192281DC1A007245F4 /* ProgressBarWithLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8200E182281DC1A007245F4 /* ProgressBarWithLabel.swift */; };
D206997721FB8A0B00CAE0DE /* MVMCoreUINavigationController.h in Headers */ = {isa = PBXBuildFile; fileRef = D206997521FB8A0B00CAE0DE /* MVMCoreUINavigationController.h */; settings = {ATTRIBUTES = (Public, ); }; };
@ -186,6 +187,7 @@
01CA51B4229716F60071A6EE /* Switch.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Switch.swift; sourceTree = "<group>"; };
01DF55DF21F8FAA800CC099B /* MFTextFieldListView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MFTextFieldListView.swift; sourceTree = "<group>"; };
01DF566F21FA5AB300CC099B /* TextFieldListFormViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TextFieldListFormViewController.swift; sourceTree = "<group>"; };
0A12149F22C11A17007C7030 /* StandardListItemWithImage.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StandardListItemWithImage.swift; sourceTree = "<group>"; };
B8200E142280C4CF007245F4 /* ProgressBar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProgressBar.swift; sourceTree = "<group>"; };
B8200E182281DC1A007245F4 /* ProgressBarWithLabel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProgressBarWithLabel.swift; sourceTree = "<group>"; };
D206997521FB8A0B00CAE0DE /* MVMCoreUINavigationController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MVMCoreUINavigationController.h; sourceTree = "<group>"; };
@ -620,6 +622,7 @@
D22D1F45220496A30077CEC0 /* MVMCoreUISwitch.m */,
DBC4391C2245232D001AB423 /* LabelWithInternalButton.swift */,
DB891E822253FA8500022516 /* Label.swift */,
0A12149F22C11A17007C7030 /* StandardListItemWithImage.swift */,
0198F7A02256A80A0066C936 /* MFRadioButton.h */,
0198F7A22256A80A0066C936 /* MFRadioButton.m */,
);
@ -975,6 +978,7 @@
D29DF13221E6851E003B2FB9 /* MVMCoreUITopAlertBaseView.m in Sources */,
D29DF29C21E7ADB9003B2FB9 /* MFProgrammaticTableViewController.m in Sources */,
0105618E224BBE7700E1557D /* FormValidator+TextFields.swift in Sources */,
0A1214A022C11A18007C7030 /* StandardListItemWithImage.swift in Sources */,
D29DF2BE21E7BEA4003B2FB9 /* TopTabbar.m in Sources */,
D2A514632213643100345BFB /* MoleculeStackCenteredTemplate.swift in Sources */,
D29DF32421ED0DA2003B2FB9 /* TextButtonView.m in Sources */,

View File

@ -0,0 +1,146 @@
//
// StandardListItemWithImage.swift
// MVMCoreUI
//
// Created by Christiano, Kevin on 6/20/19.
// Copyright © 2019 Verizon Wireless. All rights reserved.
//
import UIKit
@objcMembers open class StandardListItemWithImage: ViewConstrainingView {
//------------------------------------------------------
// MARK: - Outlets
//------------------------------------------------------
let title = Label.commonLabelH3(true)
let message = Label.commonLabelB3(true)
let button = ButtonView(frame: .zero)
let imageloader = MFLoadImageView()
let leftContainer = ViewConstrainingView.empty()
//------------------------------------------------------
// MARK: - Constraints
//------------------------------------------------------
//------------------------------------------------------
// MARK: - Initialization
//------------------------------------------------------
public init() {
super.init(frame: .zero)
}
public override init(frame: CGRect) {
super.init(frame: frame)
}
required public init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
}
public convenience init(json: [AnyHashable: Any]?, delegateObject: DelegateObject?, additionalData: [AnyHashable: Any]?) {
self.init()
setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData)
}
//------------------------------------------------------
// MARK: - View Lifecycle
//------------------------------------------------------
override open func setupView() {
super.setupView()
guard subviews.isEmpty else { return }
addSubview(leftContainer)
leftContainer.addSubview(title)
leftContainer.addSubview(message)
leftContainer.addSubview(button)
addSubview(imageloader)
imageloader.translatesAutoresizingMaskIntoConstraints = false
button.translatesAutoresizingMaskIntoConstraints = false
imageloader.imageView.contentMode = .scaleAspectFit
leftContainer.topAnchor.constraint(equalTo: topAnchor).isActive = true
leftContainer.leadingAnchor.constraint(equalTo: layoutMarginsGuide.leadingAnchor).isActive = true
let leftContainerBottom = leftContainer.bottomAnchor.constraint(equalTo: bottomAnchor)
leftContainerBottom.priority = UILayoutPriority(249)
leftContainerBottom.isActive = true
bottomAnchor.constraint(greaterThanOrEqualTo: leftContainer.bottomAnchor).isActive = true
title.topAnchor.constraint(equalTo: topAnchor).isActive = true
title.leadingAnchor.constraint(equalTo: leftContainer.leadingAnchor).isActive = true
title.widthAnchor.constraint(equalTo: leftContainer.widthAnchor).isActive = true
message.topAnchor.constraint(equalTo: title.bottomAnchor, constant: 6).isActive = true
message.leadingAnchor.constraint(equalTo: leftContainer.leadingAnchor).isActive = true
message.widthAnchor.constraint(equalTo: leftContainer.widthAnchor).isActive = true
imageloader.centerYAnchor.constraint(equalTo: centerYAnchor).isActive = true
layoutMarginsGuide.trailingAnchor.constraint(equalTo: imageloader.trailingAnchor).isActive = true
imageloader.topAnchor.constraint(greaterThanOrEqualTo: topAnchor).isActive = true
let imageloaderBottom = imageloader.bottomAnchor.constraint(equalTo: bottomAnchor)
imageloaderBottom.priority = UILayoutPriority(249)
imageloaderBottom.isActive = true
bottomAnchor.constraint(greaterThanOrEqualTo: imageloader.bottomAnchor).isActive = true
imageloader.leadingAnchor.constraint(equalTo: leftContainer.trailingAnchor, constant: 16).isActive = true
button.topAnchor.constraint(equalTo: message.bottomAnchor, constant: 12).isActive = true
button.leadingAnchor.constraint(equalTo: leftContainer.leadingAnchor).isActive = true
title.setContentHuggingPriority(UILayoutPriority(rawValue: 901), for: .horizontal)
message.setContentHuggingPriority(UILayoutPriority(rawValue: 902), for: .horizontal)
title.setContentHuggingPriority(.required, for: .vertical)
message.setContentHuggingPriority(.required, for: .vertical)
title.setContentCompressionResistancePriority(.required, for: .vertical)
message.setContentCompressionResistancePriority(.required, for: .vertical)
}
override open func updateView(_ size: CGFloat) {
super.updateView(size)
}
override open func reset() {
super.reset()
title.text = ""
message.text = ""
imageloader.imageView.image = nil
backgroundColor = nil
}
open override func setWithJSON(_ json: [AnyHashable: Any]?, delegateObject: DelegateObject?, additionalData: [AnyHashable: Any]?) {
super.setWithJSON(json, delegateObject: delegateObject as? MVMCoreUIDelegateObject, additionalData: additionalData)
guard let dictionary = json else { return }
title.setWithJSON(dictionary.optionalDictionaryForKey("title"), delegateObject: delegateObject as? MVMCoreUIDelegateObject, additionalData: additionalData)
message.setWithJSON(dictionary.optionalDictionaryForKey("message"), delegateObject: delegateObject as? MVMCoreUIDelegateObject, additionalData: additionalData)
button.setWithJSON(dictionary.optionalDictionaryForKey("button"), delegateObject: delegateObject as? MVMCoreUIDelegateObject, additionalData: additionalData)
imageloader.setWithJSON(dictionary.optionalDictionaryForKey("imageView"), delegateObject: delegateObject as? MVMCoreUIDelegateObject, additionalData: additionalData)
if let imageJSON = dictionary.optionalDictionaryForKey("imageView") {
imageloader.loadImage(withName: imageJSON.optionalStringForKey("image"),
format: imageJSON.optionalStringForKey("imageFormat"),
width: imageJSON.int32ForKey("imageWidth") as NSNumber,
height: imageJSON.int32ForKey("imageHeight") as NSNumber)
}
if let backgroundColorHex = dictionary[KeyBackgroundColor] as? String {
backgroundColor = UIColor.mfGet(forHex: backgroundColorHex)
}
}
}