Label不显示scrollView中的所有文本 [英] Label doesn't show all the text inside scrollView

查看:111
本文介绍了Label不显示scrollView中的所有文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望 DecriptionLabel (Lorem Ipsum一个)让其中的所有文本都可见。正如你所看到的,它正在被修剪。



这两个按钮应该在其他所有内容之下,但是在 DescriptionLabel 包含一个小文本,按钮应该粘在视图的底部。



这就是我选择> = 20的原因按钮与 DescriptionLabel 之间的距离是否有意义。



我该怎么办?解决文本的修剪问题?



谢谢。



但由于它被标记为重复这个,我在这里发布我的答案。请尝试设置您的约束方式如下: https://imageshack.com/a/ img923 / 6671 / Txzu98.png

诀窍是你设置 Button.Bottom等于ContainerView.Bottom 更低的优先级 (我使用750)比 Button.Top大于或等于Label.Bottom (这里我使用默认值1000)

标签必须将行数设置为0 。
按钮的高度应按高度约束设置(在这种情况下为50)。
容器视图高度约束应具有低优先级(在这种情况下为250)

您应该运行代码以在设备或模拟器上查看实际结果。故事板显示它有点不同。

对于当前的问题:
https:/ /imageshack.com/a/img923/7276/tQeT0h.png
基本想法是一样的。左按钮与上面的按钮具有相同的约束,没有 Button.Top大于或等于Label.Bottom
按钮向上和向下按钮之间应该有固定的垂直约束。我将Button Up设置为固定高度,并将尾随和前导约束设置为等于Button Down的尾随和前导。
约束 Button.Top大于或等于Label.Bottom 现在 Button Up.Top大于或等于Label.Bottom


I want the DecriptionLabel (the Lorem Ipsum one) to have all the text inside it visible. As you can see, it is getting trimmed.

The two buttons should be under everything else, but in the case where DescriptionLabel contains a small text, the buttons should stick to the bottom of the view.

This is why I chose a >= 20 distance between the buttons and DescriptionLabel if it makes any sense.

How can I solve the trimming of the text?

Thanks.

解决方案

I was originally answering How to make button stick to bottom of scroll view if the content isn't large enough? but since it is marked as duplicate of this one I am posting my answer here. Please try to set your constraints the following way: https://imageshack.com/a/img923/6671/Txzu98.png
The trick is that you set Button.Bottom Equal To ContainerView.Bottom with lower priority (I use 750) than Button.Top Greater Than Or Equal To Label.Bottom (Here I use default 1000)
The Label has to have number of lines set to 0.
The height of the button should be set by height constraint (in this case is 50).
The Container View Height constraint should be with low priority (in this case 250)
You should run the code to see actual result on device or simulator. Storyboard shows it a bit differently.

For the current question: https://imageshack.com/a/img923/7276/tQeT0h.png
The basic idea is the same.
Button Down has the same constraints as Button from above answer without Button.Top Greater Than Or Equal To Label.Bottom.
There should be fixed vertical constraint between Button Up and Button Down. I am setting Button Up with fixed Height and setting trailing and leading constraint equal to trailing and leading of Button Down.
The constraint Button.Top Greater Than Or Equal To Label.Bottom is now Button Up.Top Greater Than Or Equal To Label.Bottom

这篇关于Label不显示scrollView中的所有文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆