简体   繁体   English

如何在 iOS Swift4 中隐藏/显示 UITextView

[英]How to hide/show UITextView in iOS Swift4

textView.isHidden = true //false

I'm trying to hide/show UITextView by setting isHidden but it doesn't work properly.我试图通过设置 isHidden 来隐藏/显示 UITextView 但它不能正常工作。 It does hide the UITextView but it still shows an area where the previous content was.它确实隐藏了 UITextView,但它仍然显示了先前内容所在的区域。 See the image below.见下图。 The right side is where I'm hiding, the view is hidden as we don't see pink view, but it looks like it still has content area in it.右侧是我藏身的地方,视图被隐藏了,因为我们看不到粉红色的视图,但看起来它仍然有内容区域。 Any idea how to hide UITextView completely including it's content?知道如何完全隐藏 UITextView 包括它的内容吗? I did search but couldn't find any solution.我进行了搜索,但找不到任何解决方案。

在此处输入图片说明

将这些视图设置在单个堆栈中,因此如果您隐藏一个视图,它将自动将其容器与剩余元素一起排列。

你应该改变 textview 的高度

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM