問題描述
我希望 DecriptionLabel
(Lorem Ipsum 之一)使其中的所有文本都可見.如您所見,它正在被修剪.
I want the DecriptionLabel
(the Lorem Ipsum one) to have all the text inside it visible. As you can see, it is getting trimmed.
這兩個按鈕應該在其他所有東西的下方,但是在 DescriptionLabel
包含小文本的情況下,按鈕應該貼在視圖的底部.
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.
這就是為什么我選擇按鈕和 DescriptionLabel
之間的 >= 20
距離(如果有意義的話).
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?
謝謝.
推薦答案
我最初是在回答 如果內(nèi)容不夠大,如何讓按鈕粘在滾動視圖的底部?但是因為它被標記為這個的副本我在這里發(fā)布我的答案.請嘗試通過以下方式設置約束:https://imageshack.com/a/img923/6671/Txzu98.png
訣竅是您將 Button.Bottom Equal To ContainerView.Bottom 設置為 lower priority(我使用 750)而不是 Button.Top 大于或等于 Label.底部(這里我使用默認1000)
標簽的行數(shù)必須設置為 0.
按鈕的高度應由高度約束設置(在本例中為 50).
容器視圖高度約束應具有低優(yōu)先級(在這種情況下 250)
您應該運行代碼以查看設備或模擬器上的實際結(jié)果.故事板顯示它有點不同.
對于當前問題:https://imageshack.com/a/img923/7276/tQeT0h.png
基本思路是一樣的.
Button Down 與上述答案中的 Button 具有相同的約束,但沒有 Button.Top 大于或等于 Label.Bottom.
Button Up 和 Button Down 之間應該有固定的垂直約束.我正在設置具有固定高度的 Button Up 并設置尾隨和前導約束等于 Button Down 的尾隨和前導.
約束 Button.Top 大于或等于 Label.Bottom 現(xiàn)在是 Button Up.Top 大于或等于 Label.Bottom
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
這篇關(guān)于標簽不顯示滾動視圖中的所有文本的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!