How To Increase the height of MDCTextInputControllerOutlinedTextArea

北慕城南 提交于 2020-03-23 05:14:27

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!