我有一个 UITableView
,里面有一个 UITextView
。当我在模拟器上运行它时,textView
消失了。这里有一些图片来说明发生了什么:
Storyboard:
(textView
为绿色。)
(textViews
约束)
当我在模拟器上运行它时:
(textView
消失了。)
textView
的高度是动态的。所以我尝试创建一个与“大于或等于”相关的高度约束,并且 textView 的
高度没有改变。
(注意:当我添加一个 textField
(不是 textView
)时,它工作正常。)
Question:
Why does the
textView
disappear when I run it on the simulator, and how can I fix it?
最佳答案
如果您将 UITextView 设置为“不可”滚动:
[textView setScrollEnabled:NO];
它将能够计算固有尺寸,从而允许自动布局自行移动其他元素,然后由您来正确设置约束。
关于ios - UITableView 中的 UITextView 在模拟器上运行时消失,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29041668/