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
0 answers

How to remove animation when show/hide a UIStackView?

Whenever the UIStackView is shown or hidden, the hiding and revealing parts are animated. Is it possible to remove animation on it altogether. Like it just appears and disappears. Thank you. the current hierarchy looks like this ==> UITableView >…
as diu
  • 1,010
  • 15
  • 31
1
vote
0 answers

UIStackView in UITableViewCell going out of screen

I have used UIStackView in UITableViewCell to show additional cards for a primary card in following screen, screen for primary and additional cards Additional cards of a primary card can collapse/expand by touching bar with text "ADDITIONAL…
Ali Murad
  • 9
  • 1
  • 4
1
vote
1 answer

UIStackView dynamic height image

I'm following tutorial in appcoda. The problem is when preview the stackview between different devices the height not following the size of the device. Here is what i want: and here is what i got: Do constraint effect height in different devices ?…
1
vote
0 answers

XCode Version 8.3.3 (8E3004b) - Extremely slow, is it the StackViews which are issue?

I am using the Xcode Version 8.3.3 (8E3004b), with a MacBook Pro 2017 8 GBs of RAM. The Xcode has been very very slow in the storyboard,is it because of I am using lot of stack views. Does using a lot of stack views create problem and how many stack…
Jeet
  • 5,569
  • 8
  • 43
  • 75
1
vote
1 answer

UITableViewCell containing UIStackViews use lots of memory

Usually, my app uses around 50MB of RAM at the most, but I recently noticed that RAM usage was over 100MB. This happens on a UITableViewController. I have a prototype cell with an UIImageView, and beside it, a UIStackView which contains two labels,…
dannymout
  • 91
  • 9
1
vote
1 answer

Frame width is not the full screen width

I'm adding a gradient to a view and it's cutting off the width on one side. My code for adding the gradient is let gradientLayer = CAGradientLayer() gradientLayer.frame = fadeView.frame gradientLayer.colors = [UIColor.mainColor().cgColor,…
Cody Harness
  • 1,116
  • 3
  • 18
  • 37
1
vote
2 answers

Auto Layout using layout anchors programmatically not working

I am trying to add a stack view containing a UILabel at the top and a UICollectionView underneath. I am trying to constrain the stack view so that it takes up the full view, by anchoring it to all sides. When I run the app the UILabel appears and a…
Kobi Greene
  • 98
  • 1
  • 10
1
vote
0 answers

Conflicting constraints with fixed size UIImageView and dynamic height UILabel in self-sizing UITableViewCell

I'm trying to create a relatively simple self-sizing UITableViewCell with a UIStackView. The cell will end up similar to the default UITableViewCellSubtitle. It has a UIImageView that should be sized exactly 64x64, and next to it, a dynamic-height…
greg
  • 4,843
  • 32
  • 47
1
vote
1 answer

No preview of custom UIStackView in Storyboard despite using IBDesignable

I don't know what's causing the problem but I can't see the preview of my custom element in .storyboard file. When I run it on the device it is here and works fine (looks the same as my .xib file), but in the Storyboard it's just a blank…
mikro098
  • 2,173
  • 2
  • 32
  • 48
1
vote
1 answer

Why doesn't this stackview work in a playground?

Any ideas? import UIKit import PlaygroundSupport extension CGRect { init(_ x:CGFloat, _ y:CGFloat, _ w:CGFloat, _ h:CGFloat) { self.init(x:x, y:y, width:w, height:h) } } let v0 = UIView(frame:…
Ian Warburton
  • 15,170
  • 23
  • 107
  • 189
1
vote
0 answers

Rest of StackView doesn't shift after resizing subview

An ImageView is at the top of my UIStackView. Every time that I programmatically change the height of the ImageView, the rest of the stack view doesn't shift up or down. It stays in the same place. To change the height of the imageview, I'm…
James Dorfman
  • 1,740
  • 6
  • 18
  • 36
1
vote
1 answer

Stack Views Compressing into a Block in Xcode Simulator

So, working on a personal project of mine, after frustrating with Auto-layout constraints, I discovered Stack Views. After watching several tutorials and guides on the topic, I thought to try them out. So I created a new Xcode project and played…
Cobie Fisher
  • 713
  • 2
  • 8
  • 18
1
vote
2 answers

Problems with UIStackView constraints

I have a horizontal stack view, with an empty UIView on the left side and a label on the right side. In storyboard builder, it looks perfect (just look at the green row): However when I run the app on Sim or device, the color view just collapses and…
Cathal
  • 318
  • 4
  • 15
1
vote
0 answers

How to properly constrain Vertical StackView with multiple labels in Dynamically heighted TableView Cell

I have a tableview cell that contains a horizontal UIStackView. Inside it is an UIImageView (on the left, 100x100 dimensions) and a vertical UIStackView (on the right) that contains 4 labels. The vertical UIStackView is constrained to the…
Alex Bollbach
  • 4,370
  • 9
  • 32
  • 80
1
vote
1 answer

How to hide a view from a stack view in table view cellForRow delegate method

I'd like to know what's the cleanest way to remove a view from a stack view if a certain property in my data model is nil. I have a table view which is populated by prototype cells. They look like this: The second label text contains an optional…
Cesare
  • 9,139
  • 16
  • 78
  • 130