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
2
votes
1 answer

Custom UIView from XIB has no height in UIStackView

I am adding a custom UIView to a UIStackView inside a UIScrollView. The custom UIView is created from a XIB without a fixed width. I use autolayout to horizontally constrain the custom view to the UIStackView. All the subviews in the custom view…
jdelman
  • 683
  • 1
  • 6
  • 20
2
votes
2 answers

UIStackView not displaying

In my viewController viewDidLoad method I have: let stackView = UIStackView() stackView.axis = .Vertical self.view.addSubview(stackView) for _ in 1..<100{ let vw = UIButton(type: .System) vw.setTitle("Button",…
user5273262
2
votes
0 answers

iOS 9 - stack view alignment

I have an issue when it comes to working with the new UIStackView. My setup: 1) I added 4 constraints to the vertical-stackview, so the stack view is stretched throw the whole screen. 2) Next i changed all imageviews to "aspect fit" (i set view to…
Creative crypter
  • 1,348
  • 6
  • 30
  • 67
2
votes
1 answer

custom 'add' view animation to uistackview

I'm playing with iOS9 uistackview and having problems to customize animation when adding element. You can notice that the yellow element position is being animated from top-left corner and starting with zero width. I would like yellow element…
pzo
  • 2,087
  • 3
  • 24
  • 42
2
votes
0 answers

UIStackView's spacing vanishes when items are removed and re-added

If a UIStackView object contains three or more items, the spacing between the items remains normal when I remove the items from the stack view and then re-add them. However, if the same UIStackView object contains two items, the spacing between them…
Hans Brende
  • 7,847
  • 4
  • 37
  • 44
2
votes
1 answer

Storyboard warnings while using nested stackviews

I have a vertical stackview in my storyboard with four nested horizontal stackviews contained within it. The vertical stackview is pinned to a UIView (light blue) which in turn is pinned inside the main storyboard view. Inside each horizontal…
Scooter
  • 4,068
  • 4
  • 32
  • 47
2
votes
0 answers

How to add auto layout constraints to UIStackView inside UITableViewCell?

My requirement is when I remove object from UIStackView which is inside UITableViewCell, the cell height should become 0, i.e collapse. Since adding constraints from storyboard, it does not allow cell to completely collapse rather set a standard…
Alok
  • 119
  • 1
  • 9
2
votes
1 answer

iOS: Multi-line UILabel has wrong size with another UILabel in a horizontal UIStackView

I got a weird issue and I suspect it's a bug in UILabel, but I need to be sure first it's not my bug. The hierarchy and the problem(s): The title label gets small and on multiple lines and the year label is too large, even though there is enough…
aelveon
  • 132
  • 1
  • 1
  • 9
2
votes
4 answers

UIStackView and subview size classes

I have a UIStackView where the middle button is only visible in a different size class storyboard view After rotating the device the button will be visible because of its size class and is also in the right view hierarchy (image), but is has not…
Uwe Wittig
  • 43
  • 5
2
votes
1 answer

How to preserve a UIButton size after adding to a UIStackView

I am still learning iOS development with AutoLayout and UIStackView, so bear with me. Basically I add a UIStackView and UIButton separately on my storyboard's view and then I set a random height to my UIButton and afterwards I add my UIButton to the…
Wilson
  • 9,006
  • 3
  • 42
  • 46
2
votes
1 answer

How do I prepare a UIViewController's view for being added to a UIStackView?

This is what I'm trying to do... I have one view controller that needs to dynamically display different subviews based on the presence of some data. Here is a simple mockup. Each colored block represents a unique subview. Sometimes the green block…
sahandnayebaziz
  • 622
  • 7
  • 20
2
votes
1 answer

Issues with UIPickerView inside a StackView

I'm running into a problem with the size of my pickers when I put them inside of a stack view. The pickers change their size to their default size when they are put into the stack view. They do not do this when they are not placed into the stack…
Jel
  • 564
  • 5
  • 15
2
votes
1 answer

UIStackView inside UIScrollView with dynamically changing items

I'm trying to have a UIStackView in a UIScrollView with changing content in the UIStackView as shown below in the image. How ever I don't manage to get it to work properly. When I launch my app it does not scroll and only 10 items are shown in the…
Bjarte
  • 2,167
  • 5
  • 27
  • 37
2
votes
1 answer

UIStackView Sub StackViews with Different widths and different heights

Hi I am new to UISTackView concept , I know iOS 9 is still in beta. I have a UIStackView fills entire screen, stackview contains a number of sub UISTackViews (Nested UIStack views) , that sub UIStackViews having different heights , widths ,…
Prathap
  • 399
  • 1
  • 4
  • 13
2
votes
1 answer

IOS-9 UIStackView issue in scrolling to leading edge

I am trying to implement scroll for UIStackView where there are two buttons to add and delete views horizontally. I am changing the scroll.contentSize as the size of UIStackView so when the stack size is greater than the ScrollView's size, stack…