0

I have already referenced this and tried the top answer. However I am still unable to expand the height of the MDCTextInputControllerOutlinedTextArea. Here is the code I am using:

class CreateAnswerViewController: UIViewController, MDCMultilineTextInputDelegate, MDCMultilineTextInputLayoutDelegate {
   let answerTextField: MDCMultilineTextField = {
        let field = MDCMultilineTextField()
        field.translatesAutoresizingMaskIntoConstraints = false
        return field
    }()
   var answerTextInputController: MDCTextInputControllerOutlinedTextArea

   required init?(coder aDecoder: NSCoder) {
      self.answerTextInputController = MDCTextInputControllerOutlinedTextArea(textInput: self.answerTextField)
      self.answerTextInputController.activeColor = ApplicationScheme.instance.containerScheme.colorScheme.onBackgroundColor
      self.answerTextInputController.normalColor = ApplicationScheme.instance.containerScheme.colorScheme.onBackgroundColor
      self.answerTextInputController.placeholderText = "Answer"
      super.init(coder: aDecoder)
    }

   override func viewDidLoad() {
     self.answerTextField.multilineDelegate = self
     self.answerTextField.clearButtonMode = .never
     self.answerTextField.cursorColor = ApplicationScheme.instance.containerScheme.colorScheme.onBackgroundColor
     self.answerTextField.textColor = ApplicationScheme.instance.containerScheme.colorScheme.onBackgroundColor
     self.answerTextField.becomeFirstResponder()
     self.view.addSubview(answerTextField)
     self.answerTextField.topAnchor.constraint(equalTo: self.view.safeAreaLayoutGuide.topAnchor, constant: 65).isActive = true
     self.answerTextField.leadingAnchor.constraint(equalTo: 
     self.view.safeAreaLayoutGuide.leadingAnchor, constant: 10).isActive = true
     self.answerTextField.bottomAnchor.constraint(equalTo: 
     self.answerTextField.inputAccessoryView?.topAnchor ?? 
     self.view.safeAreaLayoutGuide.bottomAnchor, constant: 0).isActive = true
     self.view.safeAreaLayoutGuide.trailingAnchor.constraint(equalTo:     
     self.answerTextField.trailingAnchor, constant: 10).isActive = true
 }
}

Ideally, I would like the border of the text area to expand to the top of the keyboard that pops up, but I'm not sure even how to increase the height of the border like that post recommends let alone increase it to the height top of the keyboard. If I look at the backgroundcolor of the actual text input field, then I can see that it does in fact extend to the bottom of the ui view container, but the border does not. How can I fix it so that the height does adjust?

enter image description here

uioporqwerty
  • 1,068
  • 3
  • 12
  • 30

1 Answers1

0

I am using this GrowingTextView and this is working fine on my side.

https://github.com/KennethTsang/GrowingTextView

Jignesh Mayani
  • 6,937
  • 1
  • 20
  • 36