basic functioning delegation
This commit is contained in:
parent
7f6bcfc712
commit
7085122b1b
@ -137,24 +137,21 @@ class TextViewEntryField: EntryField, UITextViewDelegate, ObservingTextFieldDele
|
|||||||
|
|
||||||
@objc open override func setupFieldContainerContent(_ container: UIView) {
|
@objc open override func setupFieldContainerContent(_ container: UIView) {
|
||||||
|
|
||||||
textView.font = Styler.Font.RegularBodyLarge.getFont()
|
textView.delegate = self
|
||||||
container.addSubview(textView)
|
container.addSubview(textView)
|
||||||
|
|
||||||
NSLayoutConstraint.activate([
|
NSLayoutConstraint.activate([
|
||||||
textView.topAnchor.constraint(equalTo: container.topAnchor),
|
textView.topAnchor.constraint(equalTo: container.topAnchor, constant: Padding.Three),
|
||||||
textView.leadingAnchor.constraint(equalTo: container.leadingAnchor),
|
textView.leadingAnchor.constraint(equalTo: container.leadingAnchor, constant: Padding.Three),
|
||||||
container.trailingAnchor.constraint(equalTo: textView.leadingAnchor),
|
container.trailingAnchor.constraint(equalTo: textView.trailingAnchor, constant: Padding.Three),
|
||||||
container.bottomAnchor.constraint(equalTo: textView.bottomAnchor)
|
container.bottomAnchor.constraint(equalTo: textView.bottomAnchor, constant: Padding.Three)
|
||||||
])
|
])
|
||||||
|
|
||||||
heightConstraint = textView.heightAnchor.constraint(equalToConstant: 0)
|
heightConstraint = textView.heightAnchor.constraint(equalToConstant: 0)
|
||||||
heightConstraint?.isActive = true
|
heightConstraint?.isActive = true
|
||||||
|
|
||||||
// textView.addTarget(self, action: #selector(startEditing), for: .editingDidBegin)
|
let tap = UITapGestureRecognizer(target: self, action: #selector(startEditing))
|
||||||
// textView.addTarget(self, action: #selector(dismissFieldInput), for: .editingDidEnd)
|
entryFieldContainer.addGestureRecognizer(tap)
|
||||||
//
|
|
||||||
// let tap = UITapGestureRecognizer(target: self, action: #selector(startEditing))
|
|
||||||
// entryFieldContainer.addGestureRecognizer(tap)
|
|
||||||
|
|
||||||
accessibilityElements = [titleLabel, textView, feedbackLabel]
|
accessibilityElements = [titleLabel, textView, feedbackLabel]
|
||||||
}
|
}
|
||||||
@ -216,10 +213,6 @@ class TextViewEntryField: EntryField, UITextViewDelegate, ObservingTextFieldDele
|
|||||||
open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||||
super.set(with: model, delegateObject, additionalData)
|
super.set(with: model, delegateObject, additionalData)
|
||||||
|
|
||||||
if let color = model.backgroundColor?.uiColor {
|
|
||||||
backgroundColor = color
|
|
||||||
}
|
|
||||||
|
|
||||||
guard let model = model as? TextViewEntryFieldModel else { return }
|
guard let model = model as? TextViewEntryFieldModel else { return }
|
||||||
|
|
||||||
heightConstraint?.constant = model.height ?? 0
|
heightConstraint?.constant = model.height ?? 0
|
||||||
|
|||||||
@ -25,9 +25,9 @@ import UIKit
|
|||||||
public var hideBlinkingCaret = false
|
public var hideBlinkingCaret = false
|
||||||
|
|
||||||
public var placeholder = ""
|
public var placeholder = ""
|
||||||
|
|
||||||
public var fontStyle: Styler.Font = Styler.Font.RegularBodySmall
|
public var fontStyle: Styler.Font = Styler.Font.RegularBodySmall
|
||||||
public var placeholderFontStyle: Styler.Font = Styler.Font.RegularMicro
|
public var placeholderFontStyle: Styler.Font = Styler.Font.RegularMicro
|
||||||
|
public var placeholderTextColor: UIColor = .mvmCoolGray3
|
||||||
|
|
||||||
public var isEnabled: Bool = true {
|
public var isEnabled: Bool = true {
|
||||||
didSet {
|
didSet {
|
||||||
@ -116,7 +116,7 @@ import UIKit
|
|||||||
showsVerticalScrollIndicator = false
|
showsVerticalScrollIndicator = false
|
||||||
showsHorizontalScrollIndicator = false
|
showsHorizontalScrollIndicator = false
|
||||||
isSecureTextEntry = false
|
isSecureTextEntry = false
|
||||||
textContainerInset = UIEdgeInsets(top: Padding.Three, left: Padding.Three, bottom: Padding.Three, right: Padding.Three)
|
// textContainerInset = UIEdgeInsets(top: Padding.Three, left: Padding.Three, bottom: Padding.Three, right: Padding.Three)
|
||||||
backgroundColor = .mvmWhite
|
backgroundColor = .mvmWhite
|
||||||
clipsToBounds = true
|
clipsToBounds = true
|
||||||
smartQuotesType = .no
|
smartQuotesType = .no
|
||||||
@ -134,7 +134,14 @@ import UIKit
|
|||||||
|
|
||||||
text = ""
|
text = ""
|
||||||
textAlignment = .left
|
textAlignment = .left
|
||||||
|
placeholder = ""
|
||||||
|
fontStyle = Styler.Font.RegularBodyLarge
|
||||||
|
placeholderFontStyle = Styler.Font.RegularMicro
|
||||||
|
placeholderTextColor = .mvmCoolGray3
|
||||||
font = Styler.Font.RegularBodyLarge.getFont()
|
font = Styler.Font.RegularBodyLarge.getFont()
|
||||||
|
keyboardType = .default
|
||||||
|
isEditable = true
|
||||||
|
isEnabled = true
|
||||||
inputAccessoryView?.removeFromSuperview()
|
inputAccessoryView?.removeFromSuperview()
|
||||||
inputAccessoryView = nil
|
inputAccessoryView = nil
|
||||||
initialConfiguration()
|
initialConfiguration()
|
||||||
@ -185,7 +192,7 @@ import UIKit
|
|||||||
public func setPlaceholderContentTraits() {
|
public func setPlaceholderContentTraits() {
|
||||||
|
|
||||||
isShowingPlaceholder = true
|
isShowingPlaceholder = true
|
||||||
textColor = textViewModel?.placeholderTextColor.uiColor
|
textColor = placeholderTextColor
|
||||||
font = placeholderFontStyle.getFont()
|
font = placeholderFontStyle.getFont()
|
||||||
text = placeholder
|
text = placeholder
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user