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
vote
1 answer

Breaking constraints when the stackView is hidden

I'm using collectionView for chat box. There is a code that detects, if there is an attachment and changes the height of the collectionViewCell via (_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout,…
Bogdan Bogdanov
  • 882
  • 11
  • 36
  • 79
1
vote
1 answer

UIStackview `fillProportionally` distribution issue

I have a container stack view and it has 2 other stackviews lets call them stackview 1 and stackview 2. Stackview 2 have a custom UIView with some label. My issue is with stackview 1 and it has 2 arranged subviews. Axis of this UIStackView is…
Jaffer Sheriff
  • 1,444
  • 13
  • 33
1
vote
0 answers

Problem with center constraints for stackview. View not centered correctly

I have a problem with placing my stackView in the middle of my view controller which has a table view. I have created simple app with tabBarController and each tab bar item has its own navigationView Controller. I created my views and placed…
ShadeToD
  • 403
  • 9
  • 22
1
vote
1 answer

items inside UIStackView overflowing

I've created a UIStackView programmatically and inside placed UITextViews. when the number of the UITextViews is more than 5 the boxes start overflowing off the screen. Here's a screenshot of the situation: And here's the code : let stackview =…
Neta yam
  • 69
  • 5
1
vote
0 answers

Collection view disappears when added to a UIStackView or UIScrollView

I'm making this design in my IOS app, the final design of what I want is here, I already have the collection view for one of the rows working shown here in a video and the storyboard looks like this. It's just when I put the collection view in a…
Nathan
  • 1,393
  • 1
  • 9
  • 40
1
vote
0 answers

Disable auto-sizing UICollectionView based on label

I'm using UICollectionView with UIStackView. Inside UIStackView, there are several labels and images. I need layout of 2 columns in each row of UICollectionView. For cell sizing I'm using following method: func collectionView(_ collectionView:…
1
vote
1 answer

Change height priority of UIImageView inside UIStackView

I have an UIImageView inside UIView which is inside an horizontal UIStackView (with .fillEqually option). Horizontal UIStackView has two views always. Horizontal UIStackView gets its height from the Its' highest sub UIView. What I want to achieve:…
Emre Önder
  • 2,408
  • 2
  • 23
  • 73
1
vote
1 answer

Nested UIStackView child in UIScrollView does not stretch to fill

I have a UIStackView. I have added some views. The last view should be at to the bottom of the screen. To achieve this I have added a view that acts as a spacer, I have set a height on the first and last view with the idea that the middle view…
Teddy K
  • 820
  • 1
  • 6
  • 17
1
vote
2 answers

How can I change height of the view which is present in StackView

I have a custom UIView using for Custom UITabBar whose height is fixed 50 and I am adding a stackview for each button but I need middle button height should be more. let view: UIView = views[3] view.heightAnchor.equalToConstant(100.0).isActive =…
AppleBee
  • 452
  • 3
  • 16
1
vote
1 answer

Trying to get frame.height of one of the 2 views, that filled equally inside of a stackview

I have 2 views inside a vertical stackview(bothalf and tophalf). Their constraints dependent on that stackview.I have a horizontal stackview(containerStackView3) inside the botHalfView. Its constraints leading,trailing and height dependent on…
1
vote
2 answers

Few labels inside StackView truncated initially but appears perfectly upon scrolling

I was trying a new StackView inside TableView's cell approach for certain requirement Some Background - I have a TableView and it's cell has a stackView inside it. That stackView can have multiple types of views inside it but for the sake of…
user121095
  • 697
  • 2
  • 6
  • 18
1
vote
1 answer

stackview constraints break when adding two views inside with imageview having fixed width and height

i have a stackview with an imageview and a label underneath it but when i try to add it into stackview it doesnt appear and apparently all the constraints break.i want the imageview to be fixed width and height and the stackview to equal the width…
j.doe
  • 305
  • 3
  • 16
1
vote
1 answer

How to make stackview disappear when scrolling down and re-appear when scrolling up?

I created a stack view with 2 buttons called Services and Customize My goal is to make this stack view disappear when I scroll down and make it appear again when I scroll up. Everything works as it should be when I scroll down but when I scroll…
松田Mr.
  • 5
  • 5
1
vote
1 answer

UIScrollView overlaps other UIElements so they are not clickable anymore

Dear StackOverflowCommunity, im currently working on a project, where I need to make a fully dynamic user interface. For that, im building all of it programatically to make it as easy as possible. I've now come to a problem which is as soon as I…
J1297
  • 61
  • 4
1
vote
2 answers

Horizontal UIStackView - fix center item's size and stretch other items

I am trying to achieve a layout like this: Essentially, I need the or label to stay in the middle and occupy a fixed width and the lines to stretch out towards the edges of the screen. Here's what I did in the XIB: created a horizontal…
Sasanka Panguluri
  • 3,058
  • 4
  • 32
  • 54