update method
This commit is contained in:
parent
17983b51f5
commit
ab66cfae3c
@ -47,6 +47,20 @@ 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()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||||
|
super.setWithModel(model, delegateObject, additionalData)
|
||||||
|
guard let model = model as? LinkModel else { return }
|
||||||
|
setTitle(model.title, for: .normal)
|
||||||
|
setTitleColor(model.textColor.uiColor, for: .normal)
|
||||||
|
setTitleColor(model.disabledColor.uiColor, for: .disabled)
|
||||||
|
isEnabled = model.enabled
|
||||||
|
set(with: model.action, delegateObject: delegateObject, additionalData: additionalData)
|
||||||
|
}
|
||||||
|
|
||||||
|
public static func estimatedHeight(forRow molecule: ModuleMoleculeModel?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||||
|
return 31.0
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - MVMCoreViewProtocol
|
// MARK: - MVMCoreViewProtocol
|
||||||
@ -80,57 +94,6 @@ extension Link {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension Link: ModelMoleculeViewProtocol {
|
|
||||||
|
|
||||||
public func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) {
|
|
||||||
guard let model = model as? LinkModel else { return }
|
|
||||||
setTitle(model.title, for: .normal)
|
|
||||||
setTitleColor(model.textColor.uiColor, for: .normal)
|
|
||||||
setTitleColor(model.disabledColor.uiColor, for: .disabled)
|
|
||||||
isEnabled = model.enabled
|
|
||||||
backgroundColor = model.backgroundColor?.uiColor
|
|
||||||
set(with: model.action, delegateObject: delegateObject, additionalData: additionalData)
|
|
||||||
}
|
|
||||||
|
|
||||||
public static func estimatedHeight(forRow molecule: ModuleMoleculeModel?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
|
||||||
return 31.0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// MARK: - MVMCoreUIMoleculeViewProtocol
|
|
||||||
extension Link {
|
|
||||||
|
|
||||||
public override func setWithJSON(_ json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) {
|
|
||||||
super.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData)
|
|
||||||
self.additionalData = additionalData
|
|
||||||
self.delegateObject = delegateObject
|
|
||||||
buttonDelegate = delegateObject?.buttonDelegate
|
|
||||||
|
|
||||||
guard let dictionary = json else { return }
|
|
||||||
actionMap = dictionary
|
|
||||||
|
|
||||||
if let disabledColorHex = dictionary["disabledColor"] as? String {
|
|
||||||
setTitleColor(.mfGet(forHex: disabledColorHex), for: .disabled)
|
|
||||||
}
|
|
||||||
|
|
||||||
if let colorHex = dictionary[KeyTextColor] as? String {
|
|
||||||
setTitleColor(.mfGet(forHex: colorHex), for: .normal)
|
|
||||||
}
|
|
||||||
|
|
||||||
if let title = dictionary.optionalStringForKey(KeyTitle) {
|
|
||||||
setTitle(title, for: .normal)
|
|
||||||
}
|
|
||||||
if let enabled = dictionary[KeyEnabled] as? Bool {
|
|
||||||
isEnabled = enabled
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static func estimatedHeight(forRow json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat {
|
|
||||||
return 31
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// MARK: - MVMCoreUIViewConstrainingProtocol
|
// MARK: - MVMCoreUIViewConstrainingProtocol
|
||||||
extension Link: MVMCoreUIViewConstrainingProtocol {
|
extension Link: MVMCoreUIViewConstrainingProtocol {
|
||||||
|
|
||||||
|
|||||||
@ -69,7 +69,7 @@ public typealias ButtonAction = (Button) -> ()
|
|||||||
buttonAction?(self)
|
buttonAction?(self)
|
||||||
}
|
}
|
||||||
|
|
||||||
public func setWithAction(_ actionModel: ActionModelProtocol, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) {
|
public func set(with actionModel: ActionModelProtocol, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) {
|
||||||
self.actionModel = actionModel
|
self.actionModel = actionModel
|
||||||
buttonDelegate = delegateObject?.buttonDelegate
|
buttonDelegate = delegateObject?.buttonDelegate
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user