在网上搜索了很久,我仍然在为这个问题而苦苦挣扎。
我正在快速开发一个 iOS 应用程序,我需要在 TextView (而不是文本字段)中放置一个按钮。 该按钮应始终位于 textview 的右下角,并且当用户键入文本时 textview 展开时它不必移动。 当然,文本不应覆盖按钮。
我为此找到了几种解决方案,但与文本字段相关。 同样的方法似乎对我不起作用。
有人可以帮忙吗?
最佳答案
为什么不拥有自己的容器来容纳这两个组件。
Main View
- > TextView
- > Button
添加所需的约束。类似的东西:
**button**: height constraint; bottom constraint to container.
**TextView** top + bottom constraint to container
**Main View** height constraint (and adjust it based on button action and text)
关于ios - TextView 中的按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48923879/