basic functioning delegation

This commit is contained in:
Kevin G Christiano 2020-05-08 11:50:36 -04:00
parent 7f6bcfc712
commit 7085122b1b
2 changed files with 17 additions and 17 deletions

View File

@ -137,24 +137,21 @@ class TextViewEntryField: EntryField, UITextViewDelegate, ObservingTextFieldDele
@objc open override func setupFieldContainerContent(_ container: UIView) {
textView.font = Styler.Font.RegularBodyLarge.getFont()
textView.delegate = self
container.addSubview(textView)
NSLayoutConstraint.activate([
textView.topAnchor.constraint(equalTo: container.topAnchor),
textView.leadingAnchor.constraint(equalTo: container.leadingAnchor),
container.trailingAnchor.constraint(equalTo: textView.leadingAnchor),
container.bottomAnchor.constraint(equalTo: textView.bottomAnchor)
textView.topAnchor.constraint(equalTo: container.topAnchor, constant: Padding.Three),
textView.leadingAnchor.constraint(equalTo: container.leadingAnchor, constant: Padding.Three),
container.trailingAnchor.constraint(equalTo: textView.trailingAnchor, constant: Padding.Three),
container.bottomAnchor.constraint(equalTo: textView.bottomAnchor, constant: Padding.Three)
])
heightConstraint = textView.heightAnchor.constraint(equalToConstant: 0)
heightConstraint?.isActive = true
// textView.addTarget(self, action: #selector(startEditing), for: .editingDidBegin)
// textView.addTarget(self, action: #selector(dismissFieldInput), for: .editingDidEnd)
//
// let tap = UITapGestureRecognizer(target: self, action: #selector(startEditing))
// entryFieldContainer.addGestureRecognizer(tap)
let tap = UITapGestureRecognizer(target: self, action: #selector(startEditing))
entryFieldContainer.addGestureRecognizer(tap)
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]?) {
super.set(with: model, delegateObject, additionalData)
if let color = model.backgroundColor?.uiColor {
backgroundColor = color
}
guard let model = model as? TextViewEntryFieldModel else { return }
heightConstraint?.constant = model.height ?? 0

View File

@ -25,9 +25,9 @@ import UIKit
public var hideBlinkingCaret = false
public var placeholder = ""
public var fontStyle: Styler.Font = Styler.Font.RegularBodySmall
public var placeholderFontStyle: Styler.Font = Styler.Font.RegularMicro
public var placeholderTextColor: UIColor = .mvmCoolGray3
public var isEnabled: Bool = true {
didSet {
@ -116,7 +116,7 @@ import UIKit
showsVerticalScrollIndicator = false
showsHorizontalScrollIndicator = 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
clipsToBounds = true
smartQuotesType = .no
@ -134,7 +134,14 @@ import UIKit
text = ""
textAlignment = .left
placeholder = ""
fontStyle = Styler.Font.RegularBodyLarge
placeholderFontStyle = Styler.Font.RegularMicro
placeholderTextColor = .mvmCoolGray3
font = Styler.Font.RegularBodyLarge.getFont()
keyboardType = .default
isEditable = true
isEnabled = true
inputAccessoryView?.removeFromSuperview()
inputAccessoryView = nil
initialConfiguration()
@ -185,7 +192,7 @@ import UIKit
public func setPlaceholderContentTraits() {
isShowingPlaceholder = true
textColor = textViewModel?.placeholderTextColor.uiColor
textColor = placeholderTextColor
font = placeholderFontStyle.getFont()
text = placeholder
}