Changed name. New disabled KV. mild updates.

This commit is contained in:
Kevin G Christiano 2020-01-14 09:06:39 -05:00
parent 32f85dfbf1
commit 874addef63
2 changed files with 11 additions and 15 deletions

View File

@ -74,14 +74,6 @@ import UIKit
context?.addLine(to: CGPoint(x: x + textRect.size.width, y: y))
context?.strokePath()
}
//--------------------------------------------------
// MARK: - UITouch
//--------------------------------------------------
open override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) {
callActionBlock(self)
}
}
// MARK: - MVMCoreViewProtocol
@ -134,6 +126,10 @@ extension Link {
guard let dictionary = json else { return }
actionMap = dictionary
if let disabledColorHex = dictionary["disabledColor"] as? String {
titleColor.disabled = .mfGet(forHex: disabledColorHex)
}
if let colorHex = dictionary[KeyTextColor] as? String {
titleColor.enabled = .mfGet(forHex: colorHex)
setTitleColor(titleColor.enabled, for: .normal)
@ -153,7 +149,7 @@ extension Link {
}
}
// MARK:- MVMCoreUIViewConstrainingProtocol
// MARK: - MVMCoreUIViewConstrainingProtocol
extension Link: MVMCoreUIViewConstrainingProtocol {
public func needsToBeConstrained() -> Bool {

View File

@ -6,7 +6,7 @@
// Copyright © 2019 Verizon Wireless. All rights reserved.
//
public typealias ButtonBlock = (Button) -> ()
public typealias ButtonAction = (Button) -> ()
@objcMembers open class Button: UIButton, MFButtonProtocol {
@ -19,7 +19,7 @@ public typealias ButtonBlock = (Button) -> ()
private var initialSetupPerformed = false
private var buttonBlock: ButtonBlock?
private var buttonAction: ButtonAction?
//--------------------------------------------------
// MARK: - Delegate
@ -62,13 +62,13 @@ public typealias ButtonBlock = (Button) -> ()
// MARK: - Methods
//--------------------------------------------------
public func addBlock( event: Event, _ buttonBlock: @escaping ButtonBlock) {
self.buttonBlock = buttonBlock
public func addActionBlock( event: Event, _ buttonBlock: @escaping ButtonAction) {
self.buttonAction = buttonBlock
addTarget(self, action: #selector(callActionBlock(_:)), for: event)
}
func callActionBlock(_ sender: Button) {
buttonBlock?(self)
buttonAction?(self)
}
public func setWithActionMap(_ actionMap: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) {
@ -76,7 +76,7 @@ public typealias ButtonBlock = (Button) -> ()
buttonDelegate = delegateObject?.buttonDelegate
addBlock(event: .touchUpInside) { [weak self] sender in
addActionBlock(event: .touchUpInside) { [weak self] sender in
guard let self = self else { return }
if self.buttonDelegate?.button?(self, shouldPerformActionWithMap: actionMap, additionalData: additionalData) ?? true {