Questions tagged [uistackview]

The UIStackView class provides a streamlined interface for laying out a collection of views in either a column or a row. Stack views let you leverage the power of Auto Layout, creating user interfaces that can dynamically adapt to the device’s orientation, screen size, and any changes in the available space.

The UIStackView class provides a streamlined interface for laying out a collection of views in either a column or a row. Stack views let you leverage the power of Auto Layout, creating user interfaces that can dynamically adapt to the device’s orientation, screen size, and any changes in the available space. The stack view manages the layout of all the views in its arrangedSubviews property. These views are arranged along the stack view’s axis, based on their order in the arrangedSubviews array. The exact layout varies depending on the stack view’s axis, distribution, alignment, spacing, and other properties.

enter image description here

To use a stack view, open the Storyboard you wish to edit. Drag either a Horizontal Stack View or a Vertical Stack View out from the Object library, and position the stack view where desired. Next, drag out the stack’s content, dropping the view or control into the stack. You can continue to add views and controls to your stack, as needed. Interface Builder resizes the stack based on its content. You can also adjust the appearance of the stack’s content by modifying the Stack View’s properties in the Attributes inspector.

1429 questions
-1
votes
2 answers

UITableViewCell with undetermined number of items

I need to make a cell with some buttons. This buttons are answers options to a question. But the question and the number of buttons (answers) are not determined because I get these data from Alamofire. So there may be 2, 3, 6, or any number of…
emelagumat
  • 301
  • 2
  • 10
-1
votes
2 answers

UIStackView container view height based on subviews

Here is my simple example. I have 1 vertical stack view with 1 subview. I want that subviews height to be based on the intrinsic height of the label within it, so that I can maintain a dynamic height for the entire stack view. How can this be done?…
natecraft1
  • 2,737
  • 9
  • 36
  • 56
-1
votes
1 answer

How to get the text from a UITextfield inside a StackView

I am trying to get the text from the text field I have created inside my stackview but I am not able to do it. I was wondering if anyone could help me with this. for example what I am trying to do is this: when I press a button Label.text =…
user8922356
-1
votes
1 answer

Buttons outside of UIScrollView are not touchable

I'm facing an annoying problem with UIScrollView that my buttons cannot be touched if they are outside of the scroll view but I dont know how to fix it now I have tried some ways but no helps so far override func viewDidLayoutSubviews() { …
Uni
  • 187
  • 2
  • 7
  • 18
-1
votes
1 answer

Circular Buttons in a UIStackView ( iOS Swift )

My circular buttons in the UIStackView disfigure when the device changes. I have made the buttons circular using corner radius on the storyboard. What's the way to retain the circular shape of the button when resizing. Currently, I am giving it a…
arthas
  • 680
  • 1
  • 8
  • 16
-1
votes
2 answers

Right way to make a list with images inside a tableview cell SWIFT

I currently have a UITableView in which each cell contains a list of users. I currently have it setup using a UITextView and line break after each name. I then set the cell height accordingly to how many people are in the group.This is working great…
user6520705
  • 705
  • 3
  • 11
  • 38
-1
votes
2 answers

how to add subview at the background

I have a stackview in which there are 3 items vertically aligned. Now I created a Uiview to give it a border and adding that too in stackview to show it as a colored background of with radius corners. I am successful of creating and attaching a…
Android teem
  • 780
  • 2
  • 13
  • 36
-1
votes
1 answer

View has ambigous layout

Programmatically I'm trying to create a stack view with 5 buttons using auto layout. When i run the project then it run's without showing any error but it is not showing the button stack. On the other-hand in Debug View Hierarchy, it is showing…
WAHID MARUF
  • 51
  • 1
  • 8
-1
votes
1 answer

Best Way to Implement Stack View in This Scenario

The first ViewController that the user sees is shown below. I would like to place each row (text field + switch)into a horizontal stack view and then all eight horizontal stack views into a vertical stack view. However, I am uncertain how this would…
Lontronix
  • 193
  • 2
  • 15
-1
votes
1 answer

UIScrollView and StackView wont scroll

I added a UIScrollView to an empty ViewController, and added a vertical UIStackView to it. I set the constraint of the scrollview to 0 for each sides to fill the screen. I added a bunch of buttons to the UIStackView, but when I run the code I cannot…
breakline
  • 5,776
  • 8
  • 45
  • 84
-1
votes
1 answer

Implement Bus seating chart in ios

I am quite new to ios and lately have been faced with the challenge of implementing a bus seating chart in ios. This chart will allow users to also select preferred seats. I tried this with the stackview and the implementation did not turn out well.…
user1514567
  • 91
  • 12
-1
votes
1 answer

Bigger Width for a specific item in UIStackview in Swift

There are 7 labels in 7 UIView and UIViews are inside StackView. I want just one view ( middle one) has more width than others because labels don't fit. Is there any way to do that? When I change StackView from Fill Equally to Fill…
Emre Önder
  • 2,408
  • 2
  • 23
  • 73
-1
votes
2 answers

How to set a proportional width to subviews in UIStackView(Horizontal)

I'm having 2 views in Horizontal Stack View and the Distribution Style of that is Fill Proportionally. If One view set hidden as TRUE another view occupies all the space but when both the views are appearing Stack View is giving them a equal width…
Vinoth
  • 119
  • 1
  • 6
-1
votes
1 answer

Adding buttons (with constant width) programmatically to UIStackView

I created StackView on main.storyboard and my idea was to add some buttons of constant size 40x40 with images on them (that are originally 400x400px but they should scale down to fill that 40x40) and they should stack up like this: (stack view is…
NikolaM
  • 23
  • 9
-1
votes
1 answer

How do I set UILabel in stackview to zero when It has no strings

Hi I'm trying to use AutoLayout, StackView I have 3 UILabels in StackView. I want to implement that when UILabel has no Strings then set UILable height to zero. But It is not working. I understood about contents hugging So I also try to set priority…
Shawn Baek
  • 1,928
  • 3
  • 20
  • 34