Reputation: 445
The problem is that when I enter some text in my textView the text goes out of its set frames. I am creating everything programatically though.
Creating UITextView:
let descriptionTextView: UITextView = {
let textView = UITextView()
textView.backgroundColor = UIColor.customDarkGrayColor
textView.text = "News Description"
textView.textColor = UIColor.lightGray
textView.font = UIFont.systemFont(ofSize: 15)
textView.textContainerInset = UIEdgeInsets(top: 10, left: 16, bottom: 0, right: 16)
textView.autocorrectionType = .no
textView.setDefaultShadow()
return textView
}()
Adding as subview and Setting Constraints using my custom method:
addSubview(descriptionTextView)
descriptionTextView.anchor(top: titleTextField.bottomAnchor, left: leftAnchor, bottom: nil, right: rightAnchor, paddingTop: 10, paddingLeft: 20, paddingBottom: 0, paddingRight: 20, width: 0, height: 80)
Upvotes: 3
Views: 2487
Reputation: 1571
A possible idea of where to look into:
UITextView
is currently scrollable, so the text container has no limit on heightmasksToBounds
or clipsToBounds
to true
which is why the text appears outside of the view frame.Let me know if that helps. Cheers!
Upvotes: 8