uistackview

UIStackView - Distribute views evenly from the centre

ぐ巨炮叔叔 提交于 2019-11-29 21:30:14
I have a UIStackView ,inside a UIScrollView to show dynamically added subviews horizontally arranged. Current solution will start displaying items from the left, I would like to start distributing items from the centre without changing the width and height of the subviews. How do I do that? Im also open to solutions which doesn't use UIStackView as well. That way I could support devices < iOS9. ( Current ) ( Expected ) Short answer : ScrollView constraints Leading >= 0, Trailing >= 0, Top >= 0, Bottom >= 0 Center X and Center Y StackView constraints Leading = 0, Trailing = 0, Top = 0, Bottom =

Can you give UIStackView borders?

六眼飞鱼酱① 提交于 2019-11-29 16:10:10
问题 I'm trying to give 5 separate UIStackViews in my ViewController borders. I gave each of them an IBOutlet and then called them in viewDidLoad to use the layer property but to no avail. Is it not possible to give stack views borders, programatically? Code: @IBOutlet weak var stackView1: UIStackView! @IBOutlet weak var stackView2: UIStackView! @IBOutlet weak var stackView3: UIStackView! @IBOutlet weak var stackView4: UIStackView! @IBOutlet weak var stackView5: UIStackView! override func

How to set height of containers in stack view?

☆樱花仙子☆ 提交于 2019-11-29 13:28:48
问题 I'd like to ask you if it's possible to set height in percentage of each container placed in vertical stack view? I want to have 3 containers in stack view. First should take 40% of screen size, second 20% and third 40%. Thank you 回答1: 'Fill proportionally' distribution type works with intrinsic content size . So if our vertical stack(height say 600) view has 2 views, ViewA (intrinsic content height 200) and ViewB(intrinsic content height 100), the stack view will size them to ViewA(height

How can I set the cornerRadius of a UIStackView?

落花浮王杯 提交于 2019-11-29 09:12:20
I'm updating my app to use UIStackViews, now that most people should have updated to iOS 9. In the old version, I made a UIView consisting of two UITextFields and set its layer.cornerRadius property. In the new version, I created a UIStackView consisting of the same two UITextFields, instead of the UIView. When I try setting its layer.cornerRadius property nothing seems to happen. The documentation doesn't seem to have any helpful/relevant information. ZHZ UIStackView just manages the position and size of its arranged views, the cornerRadius has no effect. Try to add a custom view below the

UITableView not shown inside UIStackView

十年热恋 提交于 2019-11-29 08:01:33
I have a UIStackView where it can show a label, image, table view or nothing based on user selection. Here is my current hierarchy for the dynamic view: UIStackView_Parent UILabel - some text, fixed view UIStackView_Child - this is the container that can show multiple things or nothing UIView - another fixed view When I call UIStackView_Child.addArrangedSubview(...) with a label or image it works perfectly, but addArrangedSubview(tableView) does not show the table. I have tableView.scrollEnabled = false and set frame to fixed height based on number of cell and defined the table's cellHeight .

UIStackView with UILabels in Xcode 7.3

女生的网名这么多〃 提交于 2019-11-29 06:37:42
Since I've updated to Xcode 7.3 I have a problem with UIStackView . If I create an empty project and just put two UILabel s in UIStackView with default hugging and compression priorities, it shows me AutoLayout misplacement error. It even doesn't work with one(!) UILabel in UIStackView , so priorities doesn't matter (as I think, maybe there is the problem). As I remember in Xcode prior 7.3 everything was fine. I checked on two MacBook Pro separately, it's the same issue. Does anybody know how to fix it? This is a bug appears in Xcode 7.3, so you can ignore it as what he said matt. The problem

iOS - Add vertical line programatically inside a stack view

杀马特。学长 韩版系。学妹 提交于 2019-11-29 01:35:35
问题 I'm trying to add vertical lines, between labels inside a stack view all programatically. The desired finish will be something like this image: I can add the labels, all with the desired spacing; I can add horizontal lines but I can't figure out how to add those separator vertical lines in-between. I'd like to do it something like this: let stackView = UIStackView(arrangedSubviews: [label1, verticalLine, label2, verticalLine, label3]) Any hint? Thanks 回答1: You can't use the same view in two

Overlapping Views in UIStackView

点点圈 提交于 2019-11-28 23:27:27
I have an horizontal stack view that I added arranged sub views to it (7 cells). Each one of the cells in the stack has a circular badge that exceeds the view boundaries (negative constraint). When running, as you can see below, each cell is on top of the badge of the previous cell. I would like to change the order so that the badges will be fully visible. Tried playing with the Z index but it didn't help as the layers are somehow not flat as you can see in the following view hierarchy: Any idea or suggestion how to do it? Thanks. The documentation for the UIStackView class tells that: The

UIStackView - Distribute views evenly from the centre

徘徊边缘 提交于 2019-11-28 18:58:54
问题 I have a UIStackView ,inside a UIScrollView to show dynamically added subviews horizontally arranged. Current solution will start displaying items from the left, I would like to start distributing items from the centre without changing the width and height of the subviews. How do I do that? Im also open to solutions which doesn't use UIStackView as well. That way I could support devices < iOS9. ( Current ) ( Expected ) 回答1: Short answer : ScrollView constraints Leading >= 0, Trailing >= 0,

changing property contentsGravity in transform-only layer, will have no effect

血红的双手。 提交于 2019-11-28 18:18:42
问题 I started to create a very simple tic-tac-toe game. The main goal is to make the view proportional to all screen sizes of all iOS devices. So I put the image on a ViewController , make it full size of screen and then I put it into a Stack View. I've added constrains to this Stack View 0 to all sides. And when I ran the simulator then everything looks good. But I receive a message in console panel. What does it mean? 回答1: It could happen because you changed the Mode attribute of the StackView: