uistackview

How to add leading padding to view added inside an UIStackView

三世轮回 提交于 2020-06-23 20:49:59
问题 This is my setup: I have an UIScrollView with leading,top, trialing edge set to 0. Inside this I add an UIStackView with this constraints: stackView.centerYAnchor.constraintEqualToAnchor(selectedContactsScrollView.centerYAnchor).active = true stackView.leadingAnchor.constraintEqualToAnchor(selectedContactsScrollView.leadingAnchor).active = true Inside the stack view I add some views. My issue is that because of the constraints the first view added to stack view will also have leading edge = 0

How to add leading padding to view added inside an UIStackView

坚强是说给别人听的谎言 提交于 2020-06-23 20:49:28
问题 This is my setup: I have an UIScrollView with leading,top, trialing edge set to 0. Inside this I add an UIStackView with this constraints: stackView.centerYAnchor.constraintEqualToAnchor(selectedContactsScrollView.centerYAnchor).active = true stackView.leadingAnchor.constraintEqualToAnchor(selectedContactsScrollView.leadingAnchor).active = true Inside the stack view I add some views. My issue is that because of the constraints the first view added to stack view will also have leading edge = 0

Wrap items in a horizontal UIStackView on multiple lines

大城市里の小女人 提交于 2020-05-24 05:07:31
问题 I am working on an iOS app which display a UITableView of items. Each row will show a list of tags with different widths(given by the tag's text length). I can place all the tags in a horizontal UIStackView but I want them to wrap on multiple lines instead of o a single scrollable one. Basically I'm interested in a functionality similar to FlexBox's flex-wrap property. I've attached an image for reference. Any ideas how to achieve this? 回答1: There are a number of different ways to approach

Wrap items in a horizontal UIStackView on multiple lines

六月ゝ 毕业季﹏ 提交于 2020-05-24 05:07:10
问题 I am working on an iOS app which display a UITableView of items. Each row will show a list of tags with different widths(given by the tag's text length). I can place all the tags in a horizontal UIStackView but I want them to wrap on multiple lines instead of o a single scrollable one. Basically I'm interested in a functionality similar to FlexBox's flex-wrap property. I've attached an image for reference. Any ideas how to achieve this? 回答1: There are a number of different ways to approach

How to remove bottom padding of UILabel with attributedText inside UIStackView

拜拜、爱过 提交于 2020-05-17 06:18:12
问题 I want to remove the bottom padding of a UILabel with attributedText inside a UIStackview. I found this solution How to remove the extra padding below an one line UILabel. This works with normal text but not with attributed text. let textLabel = UILabel() textLabel.translatesAutoresizingMaskIntoConstraints = false textLabel.text = "What is a chemical property and how can you observe it?" textLabel.numberOfLines = 0 textLabel.lineBreakMode = .byWordWrapping textLabel.backgroundColor =