la.
This commit is contained in:
parent
bb3277e1ba
commit
ae5a1c0c02
@ -30,7 +30,7 @@ import UIKit
|
|||||||
public override var isEnabled: Bool {
|
public override var isEnabled: Bool {
|
||||||
didSet {
|
didSet {
|
||||||
if isEnabled {
|
if isEnabled {
|
||||||
titleLabel.styleB2(true)
|
titleLabel.textColor = .black
|
||||||
} else {
|
} else {
|
||||||
titleLabel.textColor = .mfBattleshipGrey()
|
titleLabel.textColor = .mfBattleshipGrey()
|
||||||
}
|
}
|
||||||
@ -49,7 +49,7 @@ import UIKit
|
|||||||
var string = ""
|
var string = ""
|
||||||
|
|
||||||
digitFields.forEach { string += $0.attributedPlaceholder?.string ?? "" }
|
digitFields.forEach { string += $0.attributedPlaceholder?.string ?? "" }
|
||||||
|
|
||||||
return !string.isEmpty ? string : nil
|
return !string.isEmpty ? string : nil
|
||||||
}
|
}
|
||||||
set {
|
set {
|
||||||
@ -90,7 +90,7 @@ import UIKit
|
|||||||
var string = ""
|
var string = ""
|
||||||
|
|
||||||
digitFields.forEach { string += $0.text ?? "" }
|
digitFields.forEach { string += $0.text ?? "" }
|
||||||
|
|
||||||
return string
|
return string
|
||||||
}
|
}
|
||||||
set {
|
set {
|
||||||
@ -157,7 +157,7 @@ import UIKit
|
|||||||
buildTextFieldsView(size: MVMCoreUISplitViewController.getDetailViewWidth())
|
buildTextFieldsView(size: MVMCoreUISplitViewController.getDetailViewWidth())
|
||||||
}
|
}
|
||||||
|
|
||||||
public init(numberOfDigits: Int, bothDelegates delegate: (UITextFieldDelegate & MFTextFieldDelegate)?, size: CGFloat? = nil) {
|
public init(numberOfDigits: Int, bothDelegates delegate: (UITextFieldDelegate & TextFieldDelegate)?, size: CGFloat? = nil) {
|
||||||
super.init(bothDelegates: delegate as? (TextFieldDelegate & UITextFieldDelegate))
|
super.init(bothDelegates: delegate as? (TextFieldDelegate & UITextFieldDelegate))
|
||||||
|
|
||||||
setup()
|
setup()
|
||||||
@ -177,7 +177,7 @@ import UIKit
|
|||||||
open func setup() {
|
open func setup() {
|
||||||
|
|
||||||
hideBorder = true
|
hideBorder = true
|
||||||
titleLabel.styleB2(true)
|
// titleLabel.styleB2(true)
|
||||||
alignCenterHorizontal()
|
alignCenterHorizontal()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -199,9 +199,9 @@ import UIKit
|
|||||||
self.titleLabel.updateView(size)
|
self.titleLabel.updateView(size)
|
||||||
|
|
||||||
if !self.digitFields.isEmpty {
|
if !self.digitFields.isEmpty {
|
||||||
|
|
||||||
StackableViewController.remove(self.digitFields)
|
StackableViewController.remove(self.digitFields)
|
||||||
|
|
||||||
self.digitFields.forEach { $0.updateView(size) }
|
self.digitFields.forEach { $0.updateView(size) }
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -225,14 +225,16 @@ import UIKit
|
|||||||
func createDigitField() -> DigitBox {
|
func createDigitField() -> DigitBox {
|
||||||
|
|
||||||
let textField = DigitBox()
|
let textField = DigitBox()
|
||||||
|
textField.isAccessibilityElement = true
|
||||||
textField.delegate = self
|
textField.delegate = self
|
||||||
textField.textBoxDelegate = self
|
textField.textBoxDelegate = self
|
||||||
|
|
||||||
return textField
|
return textField
|
||||||
}
|
}
|
||||||
|
|
||||||
func buildTextFieldsView(size: CGFloat) {
|
func buildTextFieldsView(size: CGFloat) {
|
||||||
|
|
||||||
|
var accessibleElements: [Any] = [titleLabel]
|
||||||
|
|
||||||
// Remove all current UI.
|
// Remove all current UI.
|
||||||
if !digitFields.isEmpty {
|
if !digitFields.isEmpty {
|
||||||
StackableViewController.remove(digitFields)
|
StackableViewController.remove(digitFields)
|
||||||
@ -241,7 +243,10 @@ import UIKit
|
|||||||
if numberOfDigits > 0 {
|
if numberOfDigits > 0 {
|
||||||
let digitFields = [DigitBox](repeating: createDigitField(), count: numberOfDigits)
|
let digitFields = [DigitBox](repeating: createDigitField(), count: numberOfDigits)
|
||||||
|
|
||||||
digitFields.forEach { $0.updateView(size) }
|
digitFields.forEach {
|
||||||
|
$0.updateView(size)
|
||||||
|
accessibleElements.append($0)
|
||||||
|
}
|
||||||
|
|
||||||
self.digitFields = digitFields
|
self.digitFields = digitFields
|
||||||
setupTextFieldsView(forSize: size)
|
setupTextFieldsView(forSize: size)
|
||||||
@ -249,6 +254,8 @@ import UIKit
|
|||||||
} else {
|
} else {
|
||||||
digitFields = []
|
digitFields = []
|
||||||
}
|
}
|
||||||
|
|
||||||
|
accessibilityElements = accessibleElements + [feedbackLabel]
|
||||||
}
|
}
|
||||||
|
|
||||||
override func valueChanged() {
|
override func valueChanged() {
|
||||||
@ -309,7 +316,7 @@ import UIKit
|
|||||||
|
|
||||||
validationBlock = { enteredValue in
|
validationBlock = { enteredValue in
|
||||||
guard let enteredValue = enteredValue else { return false }
|
guard let enteredValue = enteredValue else { return false }
|
||||||
|
|
||||||
return enteredValue.count > 0 && enteredValue.count == self.digitFields.count
|
return enteredValue.count > 0 && enteredValue.count == self.digitFields.count
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -379,7 +386,7 @@ import UIKit
|
|||||||
super.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData)
|
super.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData)
|
||||||
}
|
}
|
||||||
|
|
||||||
open override class func estimatedHeight(forRow json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat {
|
open override class func estimatedHeight(forRow json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat {
|
||||||
return 44
|
return 44
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -390,7 +397,7 @@ import UIKit
|
|||||||
open override class func accessibilityElements() -> [Any]? {
|
open override class func accessibilityElements() -> [Any]? {
|
||||||
// let fields = []
|
// let fields = []
|
||||||
|
|
||||||
// return self.digitFields
|
// return self.digitFields
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -14,8 +14,10 @@ import UIKit
|
|||||||
// MARK: - Outlets
|
// MARK: - Outlets
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
let dropDownCaretLabel: CaretView = {
|
let dropDownCaretView: CaretView = {
|
||||||
let caret = CaretView()
|
let caret = CaretView()
|
||||||
|
// caret.size = .medium
|
||||||
|
caret.direction = .down
|
||||||
caret.isHidden = true
|
caret.isHidden = true
|
||||||
caret.isUserInteractionEnabled = true
|
caret.isUserInteractionEnabled = true
|
||||||
return caret
|
return caret
|
||||||
@ -77,9 +79,8 @@ import UIKit
|
|||||||
|
|
||||||
private func setup() {
|
private func setup() {
|
||||||
|
|
||||||
dropDownCaretLabel.heightAnchor.constraint(equalToConstant: 40).isActive = true
|
let tapOnCaret = UITapGestureRecognizer(target: self, action: #selector(startEditing))
|
||||||
dropDownCaretWidth = widthAnchor.constraint(equalToConstant: 40)
|
dropDownCaretView.addGestureRecognizer(tapOnCaret)
|
||||||
dropDownCaretWidth?.isActive = true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -87,20 +88,19 @@ import UIKit
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
open override func setupFieldContainerContent(_ container: UIView) {
|
open override func setupFieldContainerContent(_ container: UIView) {
|
||||||
|
super.setupFieldContainerContent(container)
|
||||||
|
|
||||||
let tapOnCaret = UITapGestureRecognizer(target: self, action: #selector(startEditing))
|
container.addSubview(dropDownCaretView)
|
||||||
dropDownCaretLabel.addGestureRecognizer(tapOnCaret)
|
|
||||||
|
|
||||||
container.addSubview(dropDownCaretLabel)
|
dropDownCaretView.heightAnchor.constraint(equalToConstant: 9).isActive = true
|
||||||
|
dropDownCaretView.widthAnchor.constraint(equalToConstant: 16).isActive = true
|
||||||
|
|
||||||
textFieldTrailingConstraint?.isActive = false
|
textFieldTrailingConstraint?.isActive = false
|
||||||
dropDownCaretLabel.topAnchor.constraint(equalTo: container.topAnchor).isActive = true
|
dropDownCaretView.topAnchor.constraint(greaterThanOrEqualTo: container.topAnchor, constant: 13).isActive = true
|
||||||
textFieldTrailingConstraint = dropDownCaretLabel.leadingAnchor.constraint(equalTo: textField.trailingAnchor, constant: 6)
|
textFieldTrailingConstraint = dropDownCaretView.leadingAnchor.constraint(equalTo: textField.trailingAnchor, constant: 6)
|
||||||
textFieldTrailingConstraint?.isActive = true
|
textFieldTrailingConstraint?.isActive = true
|
||||||
container.trailingAnchor.constraint(equalTo: dropDownCaretLabel.trailingAnchor, constant: 16).isActive = true
|
container.trailingAnchor.constraint(equalTo: dropDownCaretView.trailingAnchor, constant: 16).isActive = true
|
||||||
container.bottomAnchor.constraint(equalTo: dropDownCaretLabel.bottomAnchor).isActive = true
|
container.bottomAnchor.constraint(greaterThanOrEqualTo: dropDownCaretView.bottomAnchor, constant: 13).isActive = true
|
||||||
dropDownCaretWidth = dropDownCaretLabel.widthAnchor.constraint(equalToConstant: 0)
|
|
||||||
dropDownCaretWidth?.isActive = true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -109,7 +109,7 @@ import UIKit
|
|||||||
|
|
||||||
public func showDropDown(_ show: Bool) {
|
public func showDropDown(_ show: Bool) {
|
||||||
|
|
||||||
dropDownCaretLabel.isHidden = !show
|
dropDownCaretView.isHidden = !show
|
||||||
dropDownCaretWidth?.isActive = !show
|
dropDownCaretWidth?.isActive = !show
|
||||||
setNeedsLayout()
|
setNeedsLayout()
|
||||||
layoutIfNeeded()
|
layoutIfNeeded()
|
||||||
@ -211,7 +211,7 @@ extension DropdownEntryField {
|
|||||||
else { return }
|
else { return }
|
||||||
|
|
||||||
if let _ = dictionary[KeyType] as? String {
|
if let _ = dictionary[KeyType] as? String {
|
||||||
dropDownCaretLabel.isHidden = false
|
dropDownCaretView.isHidden = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -23,6 +23,7 @@ import UIKit
|
|||||||
let label = Label()
|
let label = Label()
|
||||||
label.font = MFStyler.fontB3()
|
label.font = MFStyler.fontB3()
|
||||||
label.textColor = UIColor.mfBattleshipGrey()
|
label.textColor = UIColor.mfBattleshipGrey()
|
||||||
|
label.isAccessibilityElement = true
|
||||||
label.setContentCompressionResistancePriority(.required, for: .vertical)
|
label.setContentCompressionResistancePriority(.required, for: .vertical)
|
||||||
label.setContentCompressionResistancePriority(.required, for: .horizontal)
|
label.setContentCompressionResistancePriority(.required, for: .horizontal)
|
||||||
return label
|
return label
|
||||||
@ -32,6 +33,7 @@ import UIKit
|
|||||||
let label = Label()
|
let label = Label()
|
||||||
label.font = MFStyler.fontForTextFieldUnderLabel()
|
label.font = MFStyler.fontForTextFieldUnderLabel()
|
||||||
label.textColor = .black
|
label.textColor = .black
|
||||||
|
label.isAccessibilityElement = true
|
||||||
label.setContentCompressionResistancePriority(.required, for: .vertical)
|
label.setContentCompressionResistancePriority(.required, for: .vertical)
|
||||||
label.setContentCompressionResistancePriority(.required, for: .horizontal)
|
label.setContentCompressionResistancePriority(.required, for: .horizontal)
|
||||||
return label
|
return label
|
||||||
@ -39,6 +41,7 @@ import UIKit
|
|||||||
|
|
||||||
public private(set) var fieldContainer: UIView = {
|
public private(set) var fieldContainer: UIView = {
|
||||||
let view = UIView(frame: .zero)
|
let view = UIView(frame: .zero)
|
||||||
|
view.isAccessibilityElement = false
|
||||||
view.translatesAutoresizingMaskIntoConstraints = false
|
view.translatesAutoresizingMaskIntoConstraints = false
|
||||||
return view
|
return view
|
||||||
}()
|
}()
|
||||||
@ -175,6 +178,7 @@ import UIKit
|
|||||||
|
|
||||||
translatesAutoresizingMaskIntoConstraints = false
|
translatesAutoresizingMaskIntoConstraints = false
|
||||||
setContentCompressionResistancePriority(.required, for: .vertical)
|
setContentCompressionResistancePriority(.required, for: .vertical)
|
||||||
|
accessibilityElements = [titleLabel, feedbackLabel]
|
||||||
backgroundColor = .clear
|
backgroundColor = .clear
|
||||||
|
|
||||||
addSubview(titleLabel)
|
addSubview(titleLabel)
|
||||||
@ -310,6 +314,7 @@ import UIKit
|
|||||||
case disable
|
case disable
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Updates the visual appearance of the container, with some logical laterations as well.
|
||||||
public func updateUI(appearance: Appearance) {
|
public func updateUI(appearance: Appearance) {
|
||||||
|
|
||||||
self.appearance = appearance
|
self.appearance = appearance
|
||||||
@ -339,7 +344,7 @@ import UIKit
|
|||||||
case .disable:
|
case .disable:
|
||||||
isUserInteractionEnabled = false
|
isUserInteractionEnabled = false
|
||||||
borderStrokeColor = .mfSilver()
|
borderStrokeColor = .mfSilver()
|
||||||
titleLabel.textColor = self.isEnabled ? UIColor.mfBattleshipGrey() : UIColor.mfSilver()
|
titleLabel.textColor = self.isEnabled ? .mfBattleshipGrey() : .mfSilver()
|
||||||
bottomBar.backgroundColor = self.isEnabled ? UIColor.black.cgColor : UIColor.mfSilver().cgColor
|
bottomBar.backgroundColor = self.isEnabled ? UIColor.black.cgColor : UIColor.mfSilver().cgColor
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -20,11 +20,25 @@ import MVMCore
|
|||||||
public var isNationalMdn = true
|
public var isNationalMdn = true
|
||||||
public var shouldValidateMDN = false
|
public var shouldValidateMDN = false
|
||||||
|
|
||||||
|
private weak var outsiderTextDelegate: UITextFieldDelegate?
|
||||||
|
|
||||||
public var mdn: String? {
|
public var mdn: String? {
|
||||||
get { return MVMCoreUIUtility.removeMdnFormat(text) }
|
get { return MVMCoreUIUtility.removeMdnFormat(text) }
|
||||||
set { text = MVMCoreUIUtility.formatMdn(newValue) }
|
set { text = MVMCoreUIUtility.formatMdn(newValue) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// If you're using a MFViewController, you must set this to it
|
||||||
|
public override weak var uiTextFieldDelegate: UITextFieldDelegate? {
|
||||||
|
get { return textField.delegate }
|
||||||
|
set {
|
||||||
|
textField.delegate = newValue
|
||||||
|
outsiderTextDelegate = newValue
|
||||||
|
if newValue != nil {
|
||||||
|
textField.delegate = self
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Initializers
|
// MARK: - Initializers
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -92,7 +106,7 @@ import MVMCore
|
|||||||
clearErrorState()
|
clearErrorState()
|
||||||
} else {
|
} else {
|
||||||
errorMessage = errorMessage ?? MVMCoreUIUtility.hardcodedString(withKey: "textfield_phone_format_error_message")
|
errorMessage = errorMessage ?? MVMCoreUIUtility.hardcodedString(withKey: "textfield_phone_format_error_message")
|
||||||
UIAccessibility.post(notification: UIAccessibility.Notification.layoutChanged, argument: textField)
|
UIAccessibility.post(notification: .layoutChanged, argument: textField)
|
||||||
}
|
}
|
||||||
|
|
||||||
return isValid
|
return isValid
|
||||||
@ -145,7 +159,7 @@ import MVMCore
|
|||||||
|
|
||||||
textField.resignFirstResponder()
|
textField.resignFirstResponder()
|
||||||
|
|
||||||
return uiTextFieldDelegate?.textFieldShouldReturn?(textField) ?? true
|
return outsiderTextDelegate?.textFieldShouldReturn?(textField) ?? true
|
||||||
}
|
}
|
||||||
|
|
||||||
public func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {
|
public func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {
|
||||||
@ -154,18 +168,18 @@ import MVMCore
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
return uiTextFieldDelegate?.textField?(textField, shouldChangeCharactersIn: range, replacementString: string) ?? true
|
return outsiderTextDelegate?.textField?(textField, shouldChangeCharactersIn: range, replacementString: string) ?? true
|
||||||
}
|
}
|
||||||
|
|
||||||
public func textFieldDidBeginEditing(_ textField: UITextField) {
|
public func textFieldDidBeginEditing(_ textField: UITextField) {
|
||||||
|
|
||||||
textField.text = MVMCoreUIUtility.removeMdnFormat(textField.text)
|
textField.text = MVMCoreUIUtility.removeMdnFormat(textField.text)
|
||||||
uiTextFieldDelegate?.textFieldDidBeginEditing?(textField)
|
outsiderTextDelegate?.textFieldDidBeginEditing?(textField)
|
||||||
}
|
}
|
||||||
|
|
||||||
public func textFieldDidEndEditing(_ textField: UITextField) {
|
public func textFieldDidEndEditing(_ textField: UITextField) {
|
||||||
|
|
||||||
uiTextFieldDelegate?.textFieldDidEndEditing?(textField)
|
outsiderTextDelegate?.textFieldDidEndEditing?(textField)
|
||||||
|
|
||||||
if validateAndColor() && isNationalMdn {
|
if validateAndColor() && isNationalMdn {
|
||||||
textField.text = MVMCoreUIUtility.formatMdn(textField.text)
|
textField.text = MVMCoreUIUtility.formatMdn(textField.text)
|
||||||
@ -178,16 +192,16 @@ import MVMCore
|
|||||||
|
|
||||||
public func textFieldShouldBeginEditing(_ textField: UITextField) -> Bool {
|
public func textFieldShouldBeginEditing(_ textField: UITextField) -> Bool {
|
||||||
|
|
||||||
return uiTextFieldDelegate?.textFieldShouldBeginEditing?(textField) ?? true
|
return outsiderTextDelegate?.textFieldShouldBeginEditing?(textField) ?? true
|
||||||
}
|
}
|
||||||
|
|
||||||
public func textFieldShouldEndEditing(_ textField: UITextField) -> Bool {
|
public func textFieldShouldEndEditing(_ textField: UITextField) -> Bool {
|
||||||
|
|
||||||
return uiTextFieldDelegate?.textFieldShouldEndEditing?(textField) ?? true
|
return outsiderTextDelegate?.textFieldShouldEndEditing?(textField) ?? true
|
||||||
}
|
}
|
||||||
|
|
||||||
public func textFieldShouldClear(_ textField: UITextField) -> Bool {
|
public func textFieldShouldClear(_ textField: UITextField) -> Bool {
|
||||||
|
|
||||||
return uiTextFieldDelegate?.textFieldShouldClear?(textField) ?? true
|
return outsiderTextDelegate?.textFieldShouldClear?(textField) ?? true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -26,6 +26,7 @@ import UIKit
|
|||||||
|
|
||||||
public private(set) var textField: UITextField = {
|
public private(set) var textField: UITextField = {
|
||||||
let textField = UITextField(frame: .zero)
|
let textField = UITextField(frame: .zero)
|
||||||
|
textField.isAccessibilityElement = true
|
||||||
textField.translatesAutoresizingMaskIntoConstraints = false
|
textField.translatesAutoresizingMaskIntoConstraints = false
|
||||||
textField.setContentCompressionResistancePriority(.required, for: .vertical)
|
textField.setContentCompressionResistancePriority(.required, for: .vertical)
|
||||||
textField.font = MFStyler.fontForTextField()
|
textField.font = MFStyler.fontForTextField()
|
||||||
@ -151,6 +152,8 @@ import UIKit
|
|||||||
|
|
||||||
textFieldTrailingConstraint = container.trailingAnchor.constraint(equalTo: textField.trailingAnchor, constant: 16)
|
textFieldTrailingConstraint = container.trailingAnchor.constraint(equalTo: textField.trailingAnchor, constant: 16)
|
||||||
textFieldTrailingConstraint?.isActive = true
|
textFieldTrailingConstraint?.isActive = true
|
||||||
|
|
||||||
|
accessibilityElements = [titleLabel, textField, feedbackLabel]
|
||||||
}
|
}
|
||||||
|
|
||||||
open override func updateView(_ size: CGFloat) {
|
open override func updateView(_ size: CGFloat) {
|
||||||
|
|||||||
@ -15,7 +15,7 @@
|
|||||||
public var strokeColor: UIColor = .black
|
public var strokeColor: UIColor = .black
|
||||||
public var lineWidth: CGFloat = 1
|
public var lineWidth: CGFloat = 1
|
||||||
public var direction: Direction = .right
|
public var direction: Direction = .right
|
||||||
public var size: CaretSize?
|
// public var size: CaretSize?
|
||||||
|
|
||||||
private var caretPath: UIBezierPath = UIBezierPath()
|
private var caretPath: UIBezierPath = UIBezierPath()
|
||||||
|
|
||||||
@ -33,29 +33,29 @@
|
|||||||
// MARK: - Constraints
|
// MARK: - Constraints
|
||||||
//------------------------------------------------------
|
//------------------------------------------------------
|
||||||
|
|
||||||
public enum CaretSize: String {
|
// public enum CaretSize: String {
|
||||||
case small
|
// case small
|
||||||
case medium
|
// case medium
|
||||||
case large
|
// case large
|
||||||
|
//
|
||||||
// Dimensions of container; provided by InVision.
|
// // Dimensions of container; provided by InVision.
|
||||||
func dimensions() -> CGSize {
|
// func dimensions() -> CGSize {
|
||||||
|
//
|
||||||
switch self {
|
// switch self {
|
||||||
case .small:
|
// case .small:
|
||||||
return CGSize(width: 6, height: 10)
|
// return CGSize(width: 6, height: 10)
|
||||||
|
//
|
||||||
case .medium:
|
// case .medium:
|
||||||
return CGSize(width: 9, height: 16)
|
// return CGSize(width: 9, height: 16)
|
||||||
|
//
|
||||||
case .large:
|
// case .large:
|
||||||
return CGSize(width: 14, height: 24)
|
// return CGSize(width: 14, height: 24)
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
public var heightConstraint: NSLayoutConstraint?
|
// public var heightConstraint: NSLayoutConstraint?
|
||||||
public var widthConstraint: NSLayoutConstraint?
|
// public var widthConstraint: NSLayoutConstraint?
|
||||||
|
|
||||||
//------------------------------------------------------
|
//------------------------------------------------------
|
||||||
// MARK: - Initialization
|
// MARK: - Initialization
|
||||||
@ -88,8 +88,8 @@
|
|||||||
defaultState()
|
defaultState()
|
||||||
|
|
||||||
// Establishing references.
|
// Establishing references.
|
||||||
heightConstraint = heightAnchor.constraint(equalToConstant: 0)
|
// heightConstraint = heightAnchor.constraint(equalToConstant: 0)
|
||||||
widthConstraint = widthAnchor.constraint(equalToConstant: 0)
|
// widthConstraint = widthAnchor.constraint(equalToConstant: 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------
|
//------------------------------------------------------
|
||||||
@ -162,12 +162,12 @@
|
|||||||
|
|
||||||
@objc public func setConstraints() {
|
@objc public func setConstraints() {
|
||||||
|
|
||||||
guard let dimensions = size?.dimensions() else { return }
|
// guard let dimensions = size?.dimensions() else { return }
|
||||||
|
//
|
||||||
heightConstraint?.constant = dimensions.height
|
// heightConstraint?.constant = dimensions.height
|
||||||
heightConstraint?.isActive = true
|
// heightConstraint?.isActive = true
|
||||||
widthConstraint?.constant = dimensions.width
|
// widthConstraint?.constant = dimensions.width
|
||||||
widthConstraint?.isActive = true
|
// widthConstraint?.isActive = true
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------
|
//------------------------------------------------------
|
||||||
|
|||||||
@ -204,17 +204,13 @@ import UIKit
|
|||||||
// MARK: - Arrow
|
// MARK: - Arrow
|
||||||
/// Adds the standard mvm style caret to the accessory view
|
/// Adds the standard mvm style caret to the accessory view
|
||||||
@objc public func addCaretViewAccessory() {
|
@objc public func addCaretViewAccessory() {
|
||||||
|
|
||||||
guard accessoryView == nil else { return }
|
guard accessoryView == nil else { return }
|
||||||
|
let width: CGFloat = 6
|
||||||
|
let height: CGFloat = 10
|
||||||
caretView = CaretView(lineWidth: 1)
|
caretView = CaretView(lineWidth: 1)
|
||||||
caretView?.size = .small
|
caretView?.frame = CGRect(x: 0, y: 0, width: width, height: height)
|
||||||
caretView?.setConstraints()
|
caretViewWidthSizeObject = MFSizeObject(standardSize: width, standardiPadPortraitSize: 9)
|
||||||
|
caretViewHeightSizeObject = MFSizeObject(standardSize: height, standardiPadPortraitSize: 16)
|
||||||
if let size = caretView?.size?.dimensions() {
|
|
||||||
caretViewWidthSizeObject = MFSizeObject(standardSize: size.width, standardiPadPortraitSize: 9)
|
|
||||||
caretViewHeightSizeObject = MFSizeObject(standardSize: size.height, standardiPadPortraitSize: 16)
|
|
||||||
}
|
|
||||||
accessoryView = caretView
|
accessoryView = caretView
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user