问题
I have assigned a class named MDCMultilineTextField for Uiview from the storyboard. This class is used for Multiline TextView. My Uiview height is 400(not fix) but my UiView border is not same as height, Please verify my code and you can see screenshot below.
import MaterialComponents
@IBOutlet var viewTextView: MDCMultilineTextField!
@IBOutlet var btnDone: UIButton!
var notes=""
var dismissView: ((_ text:String) -> Void)?
var desc: MDCTextInputControllerOutlinedTextArea?
override func viewDidLoad()
{
desc = MDCTextInputControllerOutlinedTextArea(textInput: viewTextView)
viewTextView.placeholder="Description"
viewTextView.backgroundColor = UIColor.yellow
if notes != ""
{
textView.text = notes
viewTextView.text = notes
}
}
回答1:
You can assign MDCMultilineTextField.layoutDelegate
to UIView container.
It will change the container size based on MDCMultilineTextField
height.
回答2:
try this
NSLayoutConstraint(item: multilineTextField.textView, attribute: .bottom, relatedBy: .equal, toItem: multilineTextField.borderView, attribute: .bottom, multiplier: 1.0, constant: 0).isActive = true
来源:https://stackoverflow.com/questions/51101174/how-to-increase-the-height-of-mdctextinputcontrolleroutlinedtextarea