Changed atom name. making changes to LabelWithIntenralButton.
This commit is contained in:
parent
a4d9e770e5
commit
845036b4ec
@ -164,7 +164,7 @@
|
||||
D2E1FADD2268B25E00AEFD8C /* MoleculeTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2E1FADC2268B25E00AEFD8C /* MoleculeTableViewCell.swift */; };
|
||||
D2E1FADF2268B8E700AEFD8C /* ThreeLayerTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2E1FADE2268B8E700AEFD8C /* ThreeLayerTableViewController.swift */; };
|
||||
D2E1FAE12268E81D00AEFD8C /* MoleculeListTemplate.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2E1FAE02268E81D00AEFD8C /* MoleculeListTemplate.swift */; };
|
||||
DB06250B2293456500B72DD3 /* StandardListItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB06250A2293456500B72DD3 /* StandardListItem.swift */; };
|
||||
DB06250B2293456500B72DD3 /* LeftRightLabelView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB06250A2293456500B72DD3 /* LeftRightLabelView.swift */; };
|
||||
DBC4391822442197001AB423 /* CaretView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DBC4391622442196001AB423 /* CaretView.swift */; };
|
||||
DBC4391922442197001AB423 /* DashLine.swift in Sources */ = {isa = PBXBuildFile; fileRef = DBC4391722442197001AB423 /* DashLine.swift */; };
|
||||
DBC4391B224421A0001AB423 /* CaretButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = DBC4391A224421A0001AB423 /* CaretButton.swift */; };
|
||||
@ -333,7 +333,7 @@
|
||||
D2E1FADC2268B25E00AEFD8C /* MoleculeTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MoleculeTableViewCell.swift; sourceTree = "<group>"; };
|
||||
D2E1FADE2268B8E700AEFD8C /* ThreeLayerTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ThreeLayerTableViewController.swift; sourceTree = "<group>"; };
|
||||
D2E1FAE02268E81D00AEFD8C /* MoleculeListTemplate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MoleculeListTemplate.swift; sourceTree = "<group>"; };
|
||||
DB06250A2293456500B72DD3 /* StandardListItem.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StandardListItem.swift; sourceTree = "<group>"; };
|
||||
DB06250A2293456500B72DD3 /* LeftRightLabelView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LeftRightLabelView.swift; sourceTree = "<group>"; };
|
||||
DB891E822253FA8500022516 /* Label.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Label.swift; sourceTree = "<group>"; };
|
||||
DBC4391622442196001AB423 /* CaretView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CaretView.swift; sourceTree = "<group>"; };
|
||||
DBC4391722442197001AB423 /* DashLine.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DashLine.swift; sourceTree = "<group>"; };
|
||||
@ -584,7 +584,7 @@
|
||||
children = (
|
||||
DBC4391622442196001AB423 /* CaretView.swift */,
|
||||
DBC4391722442197001AB423 /* DashLine.swift */,
|
||||
DB06250A2293456500B72DD3 /* StandardListItem.swift */,
|
||||
DB06250A2293456500B72DD3 /* LeftRightLabelView.swift */,
|
||||
D29DF17E21E69E2E003B2FB9 /* MFView.h */,
|
||||
D29DF17F21E69E2E003B2FB9 /* MFView.m */,
|
||||
D29DF31E21ED0CBA003B2FB9 /* LabelView.h */,
|
||||
@ -942,7 +942,7 @@
|
||||
D29DF29521E7ADB8003B2FB9 /* ProgrammaticScrollViewController.m in Sources */,
|
||||
D29DF16121E69996003B2FB9 /* MFViewController.m in Sources */,
|
||||
D2E1FAE12268E81D00AEFD8C /* MoleculeListTemplate.swift in Sources */,
|
||||
DB06250B2293456500B72DD3 /* StandardListItem.swift in Sources */,
|
||||
DB06250B2293456500B72DD3 /* LeftRightLabelView.swift in Sources */,
|
||||
D22D1F47220496A30077CEC0 /* MVMCoreUISwitch.m in Sources */,
|
||||
D29DF28C21E7AC2B003B2FB9 /* ViewConstrainingView.m in Sources */,
|
||||
D29DF17B21E69E1F003B2FB9 /* PrimaryButton.m in Sources */,
|
||||
|
||||
@ -154,11 +154,6 @@ public typealias ActionBlock = () -> Void
|
||||
// MARK: - Functions
|
||||
//------------------------------------------------------
|
||||
|
||||
/**
|
||||
- Parameters:
|
||||
- label: The label to be set.
|
||||
- html: any html string.
|
||||
*/
|
||||
@objc public static func setLabel(_ label: UILabel?, withHTML html: String?) {
|
||||
|
||||
guard let data = html?.data(using: .utf8) else { return }
|
||||
@ -175,17 +170,10 @@ public typealias ActionBlock = () -> Void
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
- Parameters:
|
||||
- label: The current label view that will have an actionable range of text.
|
||||
- json: Contains values which det the values of Label.
|
||||
- delegate:
|
||||
- additionalData:
|
||||
*/
|
||||
@objc public static func setUILabel(_ label: UILabel?, withJSON json: [AnyHashable: Any]?, delegate: DelegateObject?, additionalData: [AnyHashable: Any]?) {
|
||||
|
||||
guard let label = label else { return }
|
||||
|
||||
label.attributedText = nil
|
||||
label.text = json?.optionalStringForKey(KeyText)
|
||||
|
||||
setLabel(label, withHTML: json?.optionalStringForKey("html"))
|
||||
@ -376,8 +364,8 @@ extension Label {
|
||||
}
|
||||
|
||||
public func createActionBlockFrom(actionMap: [AnyHashable: Any]?, additionalData: [AnyHashable: Any]?, delegateObject: DelegateObject?) -> ActionBlock {
|
||||
return {
|
||||
if (delegateObject as? MVMCoreUIDelegateObject)?.buttonDelegate?.button?(self, shouldPerformActionWithMap: actionMap, additionalData: additionalData) ?? true {
|
||||
return { [weak self] in
|
||||
if (delegateObject as? MVMCoreUIDelegateObject)?.buttonDelegate?.button?(self!, shouldPerformActionWithMap: actionMap, additionalData: additionalData) ?? true {
|
||||
MVMCoreActionHandler.shared()?.handleAction(with: actionMap, additionalData: additionalData, delegateObject: delegateObject)
|
||||
}
|
||||
}
|
||||
|
||||
@ -450,7 +450,7 @@ public typealias CoreObjectActionLoadPresentDelegate = MVMCoreActionDelegateProt
|
||||
|
||||
setText(fullText, startTag: startTag, endTag: endTag)
|
||||
|
||||
actionBlock = {
|
||||
actionBlock = { [weak delegate] in
|
||||
MVMCoreActionHandler.shared()?.handleAction(with: actionMap, additionalData: additionalData, delegate: delegate as? CoreObjectActionLoadPresentDelegate)
|
||||
}
|
||||
}
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
import Foundation
|
||||
|
||||
|
||||
@objcMembers open class StandardListItem: ViewConstrainingView {
|
||||
@objcMembers open class LeftRightLabelView: ViewConstrainingView {
|
||||
//------------------------------------------------------
|
||||
// MARK: - Properties
|
||||
//------------------------------------------------------
|
||||
@ -25,6 +25,9 @@ import Foundation
|
||||
var messageTrail: NSLayoutConstraint?
|
||||
var titleTrail: NSLayoutConstraint?
|
||||
|
||||
var titleDetailBaseline: NSLayoutConstraint?
|
||||
var messageDetailBaseline: NSLayoutConstraint?
|
||||
|
||||
//------------------------------------------------------
|
||||
// MARK: - Initialization
|
||||
//------------------------------------------------------
|
||||
@ -41,7 +44,7 @@ import Foundation
|
||||
super.init(coder: aDecoder)
|
||||
}
|
||||
|
||||
public convenience init(actionMap: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) {
|
||||
public convenience init(actionMap: [AnyHashable: Any]?, delegateObject: DelegateObject?, additionalData: [AnyHashable: Any]?) {
|
||||
self.init()
|
||||
setWithJSON(actionMap: actionMap, delegateObject: delegateObject, additionalData: additionalData)
|
||||
}
|
||||
@ -60,9 +63,14 @@ import Foundation
|
||||
override open func updateView(_ size: CGFloat) {
|
||||
super.updateView(size)
|
||||
|
||||
title?.updateView(size)
|
||||
message?.updateView(size)
|
||||
detail?.updateView(size)
|
||||
|
||||
if let titleText = title?.text, let messageText = message?.text, titleText.isEmpty && messageText.isEmpty {
|
||||
detailWidth?.constant = size
|
||||
detail?.bottomAnchor.constraint(equalTo: bottomAnchor, constant: -PaddingTwo).isActive = true
|
||||
titleDetailBaseline?.isActive = false
|
||||
return
|
||||
}
|
||||
|
||||
@ -81,6 +89,8 @@ import Foundation
|
||||
messageWidth?.constant = size * 0.6 - PaddingOne
|
||||
detailWidth?.constant = size * 0.2
|
||||
titleWidth?.constant = 0
|
||||
titleDetailBaseline?.isActive = false
|
||||
messageDetailBaseline?.isActive = true
|
||||
return
|
||||
}
|
||||
|
||||
@ -116,19 +126,27 @@ import Foundation
|
||||
message.textAlignment = .left
|
||||
detail.textAlignment = .right
|
||||
|
||||
NSLayoutConstraint.constraintPinSubview(title, pinTop: true, topConstant: PaddingTwo, pinBottom: false, bottomConstant: 0, pinLeft: true, leftConstant: 0, pinRight: false, rightConstant: 0)
|
||||
NSLayoutConstraint.constraintPinSubview(message, pinTop: false, topConstant: 0, pinBottom: true, bottomConstant: PaddingTwo, pinLeft: true, leftConstant: 0, pinRight: false, rightConstant: 0)
|
||||
NSLayoutConstraint.constraintPinSubview(detail, pinTop: true, topConstant: PaddingTwo, pinBottom: false, bottomConstant: 0, pinLeft: false, leftConstant: 0, pinRight: true, rightConstant: 0)
|
||||
NSLayoutConstraint(pinFirstView: title, toSecondView: message, withConstant: 0, directionVertical: true)?.isActive = true
|
||||
|
||||
let titleTrail = title.trailingAnchor.constraint(greaterThanOrEqualTo: detail.leadingAnchor, constant: PaddingOne)
|
||||
title.topAnchor.constraint(equalTo: topAnchor).isActive = true
|
||||
title.leadingAnchor.constraint(equalTo: leadingAnchor).isActive = true
|
||||
let titleTrail = title.trailingAnchor.constraint(greaterThanOrEqualTo: detail.leadingAnchor)
|
||||
titleTrail.isActive = true
|
||||
|
||||
let messageTrail = message.trailingAnchor.constraint(greaterThanOrEqualTo: detail.leadingAnchor, constant: PaddingOne)
|
||||
message.topAnchor.constraint(equalTo: title.bottomAnchor).isActive = true
|
||||
message.leadingAnchor.constraint(equalTo: leadingAnchor).isActive = true
|
||||
message.bottomAnchor.constraint(equalTo: bottomAnchor).isActive = true
|
||||
let messageTrail = message.trailingAnchor.constraint(greaterThanOrEqualTo: detail.leadingAnchor)
|
||||
messageTrail.isActive = true
|
||||
|
||||
detail.topAnchor.constraint(equalTo: topAnchor).isActive = true
|
||||
detail.trailingAnchor.constraint(equalTo: trailingAnchor).isActive = true
|
||||
|
||||
titleDetailBaseline = detail.firstBaselineAnchor.constraint(equalTo: title.firstBaselineAnchor)
|
||||
titleDetailBaseline?.isActive = true
|
||||
|
||||
messageDetailBaseline = detail.firstBaselineAnchor.constraint(equalTo: message.firstBaselineAnchor)
|
||||
|
||||
titleWidth = title.widthAnchor.constraint(lessThanOrEqualToConstant: bounds.width * 0.8 - PaddingOne)
|
||||
titleWidth?.priority = UILayoutPriority(rawValue: 750)
|
||||
titleWidth?.priority = UILayoutPriority(rawValue: 751)
|
||||
titleWidth?.isActive = true
|
||||
|
||||
messageWidth = message.widthAnchor.constraint(lessThanOrEqualToConstant: bounds.width * 0.8 - PaddingOne)
|
||||
@ -136,7 +154,7 @@ import Foundation
|
||||
messageWidth?.isActive = true
|
||||
|
||||
detailWidth = detail.widthAnchor.constraint(equalToConstant: bounds.width * 0.2)
|
||||
detailWidth?.priority = UILayoutPriority(rawValue: 755)
|
||||
detailWidth?.priority = UILayoutPriority(rawValue: 850)
|
||||
detailWidth?.isActive = true
|
||||
|
||||
title.setContentHuggingPriority(UILayoutPriority(rawValue: 251), for: .horizontal)
|
||||
@ -149,14 +167,14 @@ import Foundation
|
||||
message.setContentCompressionResistancePriority(UILayoutPriority(rawValue: 749), for: .horizontal)
|
||||
message.setContentCompressionResistancePriority(UILayoutPriority(rawValue: 250), for: .vertical)
|
||||
|
||||
detail.setContentHuggingPriority(UILayoutPriority(rawValue: 251), for: .horizontal)
|
||||
detail.setContentHuggingPriority(UILayoutPriority(rawValue: 750), for: .horizontal)
|
||||
detail.setContentHuggingPriority(UILayoutPriority(rawValue: 249), for: .vertical)
|
||||
detail.setContentCompressionResistancePriority(UILayoutPriority(rawValue: 750), for: .horizontal)
|
||||
detail.setContentCompressionResistancePriority(.required, for: .vertical)
|
||||
detail.setContentCompressionResistancePriority(UILayoutPriority(rawValue: 999), for: .vertical)
|
||||
}
|
||||
}
|
||||
|
||||
func setWithJSON(actionMap: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) {
|
||||
func setWithJSON(actionMap: [AnyHashable: Any]?, delegateObject: DelegateObject?, additionalData: [AnyHashable: Any]?) {
|
||||
|
||||
guard let dictionary = actionMap else { return }
|
||||
|
||||
@ -178,7 +196,7 @@ import Foundation
|
||||
defaultState()
|
||||
}
|
||||
|
||||
open override func setWithJSON(_ json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) {
|
||||
open override func setWithJSON(_ json: [AnyHashable: Any]?, delegateObject: DelegateObject?, additionalData: [AnyHashable: Any]?) {
|
||||
super.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData)
|
||||
setWithJSON(actionMap: json, delegateObject: delegateObject, additionalData: additionalData)
|
||||
}
|
||||
@ -38,7 +38,7 @@
|
||||
@"listItem": MoleculeTableViewCell.class,
|
||||
@"switchLineItem": SwitchLineItem.class,
|
||||
@"switch": Switch.class,
|
||||
@"standardListItem": StandardListItem.class
|
||||
@"leftRightLabelView": LeftRightLabelView.class
|
||||
} mutableCopy];
|
||||
});
|
||||
return mapping;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user