文本视图内的按钮

3
经过在网上长时间的搜索后,我仍在为这个问题苦苦挣扎。
我正在使用Swift开发iOS应用程序,需要在文本视图(而不是文本框)中放置一个按钮。 该按钮应始终位于文本视图的右下角,并且当用户键入文本时,它不必随着文本视图的扩展而移动。 当然,文本不应覆盖按钮。
我找到了几种解决方案,但都是针对文本框的。 同样的方法似乎对我不起作用。
能有人帮忙吗?

1
最棘手的问题将是防止文本重叠按钮。也许你应该看一下exclusionPath,就像这里:https://littlebitesofcocoa.com/280-flowing-text-around-images-with-exclusion-paths - Andreas Oetjen
1个回答

0
为什么不拥有一个容器,可以同时包含这两个组件呢?
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)

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接