Changed name. New disabled KV. mild updates.
This commit is contained in:
parent
32f85dfbf1
commit
874addef63
@ -74,14 +74,6 @@ import UIKit
|
|||||||
context?.addLine(to: CGPoint(x: x + textRect.size.width, y: y))
|
context?.addLine(to: CGPoint(x: x + textRect.size.width, y: y))
|
||||||
context?.strokePath()
|
context?.strokePath()
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
|
||||||
// MARK: - UITouch
|
|
||||||
//--------------------------------------------------
|
|
||||||
|
|
||||||
open override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) {
|
|
||||||
callActionBlock(self)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - MVMCoreViewProtocol
|
// MARK: - MVMCoreViewProtocol
|
||||||
@ -134,6 +126,10 @@ extension Link {
|
|||||||
guard let dictionary = json else { return }
|
guard let dictionary = json else { return }
|
||||||
actionMap = dictionary
|
actionMap = dictionary
|
||||||
|
|
||||||
|
if let disabledColorHex = dictionary["disabledColor"] as? String {
|
||||||
|
titleColor.disabled = .mfGet(forHex: disabledColorHex)
|
||||||
|
}
|
||||||
|
|
||||||
if let colorHex = dictionary[KeyTextColor] as? String {
|
if let colorHex = dictionary[KeyTextColor] as? String {
|
||||||
titleColor.enabled = .mfGet(forHex: colorHex)
|
titleColor.enabled = .mfGet(forHex: colorHex)
|
||||||
setTitleColor(titleColor.enabled, for: .normal)
|
setTitleColor(titleColor.enabled, for: .normal)
|
||||||
@ -153,7 +149,7 @@ extension Link {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK:- MVMCoreUIViewConstrainingProtocol
|
// MARK: - MVMCoreUIViewConstrainingProtocol
|
||||||
extension Link: MVMCoreUIViewConstrainingProtocol {
|
extension Link: MVMCoreUIViewConstrainingProtocol {
|
||||||
|
|
||||||
public func needsToBeConstrained() -> Bool {
|
public func needsToBeConstrained() -> Bool {
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
// Copyright © 2019 Verizon Wireless. All rights reserved.
|
// Copyright © 2019 Verizon Wireless. All rights reserved.
|
||||||
//
|
//
|
||||||
|
|
||||||
public typealias ButtonBlock = (Button) -> ()
|
public typealias ButtonAction = (Button) -> ()
|
||||||
|
|
||||||
|
|
||||||
@objcMembers open class Button: UIButton, MFButtonProtocol {
|
@objcMembers open class Button: UIButton, MFButtonProtocol {
|
||||||
@ -19,7 +19,7 @@ public typealias ButtonBlock = (Button) -> ()
|
|||||||
|
|
||||||
private var initialSetupPerformed = false
|
private var initialSetupPerformed = false
|
||||||
|
|
||||||
private var buttonBlock: ButtonBlock?
|
private var buttonAction: ButtonAction?
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Delegate
|
// MARK: - Delegate
|
||||||
@ -62,13 +62,13 @@ public typealias ButtonBlock = (Button) -> ()
|
|||||||
// MARK: - Methods
|
// MARK: - Methods
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
public func addBlock( event: Event, _ buttonBlock: @escaping ButtonBlock) {
|
public func addActionBlock( event: Event, _ buttonBlock: @escaping ButtonAction) {
|
||||||
self.buttonBlock = buttonBlock
|
self.buttonAction = buttonBlock
|
||||||
addTarget(self, action: #selector(callActionBlock(_:)), for: event)
|
addTarget(self, action: #selector(callActionBlock(_:)), for: event)
|
||||||
}
|
}
|
||||||
|
|
||||||
func callActionBlock(_ sender: Button) {
|
func callActionBlock(_ sender: Button) {
|
||||||
buttonBlock?(self)
|
buttonAction?(self)
|
||||||
}
|
}
|
||||||
|
|
||||||
public func setWithActionMap(_ actionMap: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) {
|
public func setWithActionMap(_ actionMap: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) {
|
||||||
@ -76,7 +76,7 @@ public typealias ButtonBlock = (Button) -> ()
|
|||||||
|
|
||||||
buttonDelegate = delegateObject?.buttonDelegate
|
buttonDelegate = delegateObject?.buttonDelegate
|
||||||
|
|
||||||
addBlock(event: .touchUpInside) { [weak self] sender in
|
addActionBlock(event: .touchUpInside) { [weak self] sender in
|
||||||
guard let self = self else { return }
|
guard let self = self else { return }
|
||||||
|
|
||||||
if self.buttonDelegate?.button?(self, shouldPerformActionWithMap: actionMap, additionalData: additionalData) ?? true {
|
if self.buttonDelegate?.button?(self, shouldPerformActionWithMap: actionMap, additionalData: additionalData) ?? true {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user