uilabel

NSAttributedString text always sticks to bottom with big lineHeight

混江龙づ霸主 提交于 2020-12-13 03:28:56
问题 I'm trying to implement by-design labels coming from Sketch e.g. I need text styles with font size = 19 and line height = 50. So I ended up using NSAttributedString with NSMutableParagraphStyle but was stopped by problem with text being sticked to bottom of UILabel I've already tried to use lineHeightMultiple and lineSpacing but those didn't give me the line height I wanted so I ended up using minimumLineHeight and maximumLineHeight equal the same Here is my approach to make

Swift - How to resize a UIView based on its UILabel size (that is inside)

流过昼夜 提交于 2020-12-06 02:59:28
问题 I'm a bit new in Swift, and I need some help with this: I have a UILabel inside a UIView, and this label can receive any ammount of text. So I want to resize the UILabel based on the text it receives, and also resizes its container, the UIView. The UILabel must have a max width but not max height. It is very similar to what happens in Whatsapp with a message text (his green container grows accordly the text inside). I believe it is about auto layout, but I really can't understand most of it.

Horizontal UIStackView with two label (one multiline label, one one-line)

◇◆丶佛笑我妖孽 提交于 2020-12-04 03:43:23
问题 I have a horizontal UIStackView which has two UILabel in it. First UILabel is multiline (two line) and other one is one line only. They both have default content compression and resistance priorities. My problem is that even there is a gap between labels, "best" word in first text goes second line. I noticed that first label doesn't goes beyond half of total width. What I want is that second label should always show itself and first label should size It self for remaining space. If It can't

Horizontal UIStackView with two label (one multiline label, one one-line)

旧巷老猫 提交于 2020-12-04 03:43:21
问题 I have a horizontal UIStackView which has two UILabel in it. First UILabel is multiline (two line) and other one is one line only. They both have default content compression and resistance priorities. My problem is that even there is a gap between labels, "best" word in first text goes second line. I noticed that first label doesn't goes beyond half of total width. What I want is that second label should always show itself and first label should size It self for remaining space. If It can't

Horizontal UIStackView with two label (one multiline label, one one-line)

孤人 提交于 2020-12-04 03:39:19
问题 I have a horizontal UIStackView which has two UILabel in it. First UILabel is multiline (two line) and other one is one line only. They both have default content compression and resistance priorities. My problem is that even there is a gap between labels, "best" word in first text goes second line. I noticed that first label doesn't goes beyond half of total width. What I want is that second label should always show itself and first label should size It self for remaining space. If It can't

Set labels in a custom cell to names from an array using a separate controller

给你一囗甜甜゛ 提交于 2020-08-10 19:17:55
问题 I have a view controller with a table. The view controller has a button that segues to another controller with 4 textfields. There is a name textfield and three others where numbers can be inputed. When a user presses add, an array is appended and the view controller is dismissed while updating the table in the previous view controller. The user is then presented a table with a new cell added. The cell has 4 labels. I am trying to figure out how to set each label in a cell to the 4 textfields