From 01780e708f71e350684a89adb54c63c9a94bd9c3 Mon Sep 17 00:00:00 2001 From: "Xinlei(Ryan) Pan" Date: Tue, 21 Jan 2020 15:33:10 -0500 Subject: [PATCH] update link --- MVMCoreUI/Atoms/Buttons/Link.swift | 37 ++++++------------------------ 1 file changed, 7 insertions(+), 30 deletions(-) diff --git a/MVMCoreUI/Atoms/Buttons/Link.swift b/MVMCoreUI/Atoms/Buttons/Link.swift index 39187ac8..02778bce 100644 --- a/MVMCoreUI/Atoms/Buttons/Link.swift +++ b/MVMCoreUI/Atoms/Buttons/Link.swift @@ -30,25 +30,7 @@ import UIKit //-------------------------------------------------- private var delegateObject: MVMCoreUIDelegateObject? - - //-------------------------------------------------- - // MARK: - Initializers - //-------------------------------------------------- - - public override init(frame: CGRect) { - super.init(frame: frame) - setupView() - } - - public convenience init() { - self.init(frame: .zero) - } - - public required init?(coder: NSCoder) { - super.init(coder: coder) - setupView() - } - + //-------------------------------------------------- // MARK: - Lifecycle //-------------------------------------------------- @@ -95,8 +77,7 @@ extension Link { } public override func setupView() { - - translatesAutoresizingMaskIntoConstraints = false + super.setupView() backgroundColor = .clear contentMode = .redraw setTitleColor(.mfTextButton(), for: .normal) @@ -118,17 +99,17 @@ extension Link: ModelMoleculeViewProtocol { backgroundColor = model.backgroundColor?.uiColor set(with: model.action, delegateObject: delegateObject, additionalData: additionalData) } + + + public static func estimatedHeight(forRow molecule: MoleculeProtocol?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { + return 31.0 + } } // MARK: - MVMCoreUIMoleculeViewProtocol extension Link { - public override func reset() { - super.reset() - setTitleColor(.mfTextButton(), for: .normal) - } - public override func setWithJSON(_ json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) { super.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData) self.additionalData = additionalData @@ -164,10 +145,6 @@ extension Link { // MARK: - MVMCoreUIViewConstrainingProtocol extension Link: MVMCoreUIViewConstrainingProtocol { - public func needsToBeConstrained() -> Bool { - return true - } - public func alignment() -> UIStackView.Alignment { return .leading }