0
问题是,当我在textView 中输入一些文本时,文本将从其设置的框架中移出。 虽然我以编程方式创建一切。UITextView中的文本超出其框架Swift 3
创建的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
}()
添加为子视图并设置限制使用我的自定义方法:
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)
非常感谢你给我正确的提示! 问题在于您刚刚说过的设置自定义阴影。我刚刚删除,现在一切正常! :) –
很高兴帮助!快乐编码:) –
由于这类问题,我通常使用包装视图来显示阴影。 –