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?.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 {
|
||||
|
||||
@ -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 {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user