Skip to main content
Filter by
Sorted by
Tagged with
0 votes
1 answer
23 views

How do I add custom horizontal spacing to a view in a stack view with a leading alignment and vertical axis?

I have a stack view that contains a title label and a view which happens to be another stack view that I want to add custom spacing to. The composition I am using is based on the way that is described ...
Asaad Jaber's user avatar
-3 votes
1 answer
64 views

Mysterious behavior of stack view with a container view in it: items prior to a container don't appear [closed]

Start a Mac, open Xcode, create a new swift-storyboard project and paste in the demo code below. Fire it up and you will see a jiggly scrollable stack something like this .. All good so far. Let's ...
Fattie's user avatar
  • 12.5k
-1 votes
1 answer
53 views

UIStackView change distribution from fill to fillEqually confusingly

As the picture : My Inner StackView (horizontal) set distribution to fill When you add two labels to this inner stackview , these two labels will got the same width . seems the distribution is set to ...
ximmyxiao's user avatar
  • 2,801
-1 votes
1 answer
84 views

How to dynamically add rows to UITableviewCell in efficient manner?

I need to have UI structure where my table cell can have text (that is easy to implement as it will automatically increase table cell height) and also can have multiple records shown in below image: ...
NSPratik's user avatar
  • 4,836
-2 votes
1 answer
53 views

UIStackView conflict strangely with Top Align in Alignment axis?

I have two top aligned HStackViews(with red & green background color) embeded in a VStackView. If I add a label to each HStackView , the layout will got a vertical conflict like this: And if I ...
ximmyxiao's user avatar
  • 2,801
0 votes
1 answer
46 views

Unexpected animation from UICalendarView embedded in UIStackView

I have a UICalendarView that is embedded in a UIStackView. When I hide/show items in the stack and cause the height of the stack to change, the UICalendarView animates unexpectedly: Note that the ...
moliveira's user avatar
  • 828
1 vote
1 answer
47 views

UIStackView wrong distribution if subviews are UIButton created with UIButton.Configuration

The UIStackView doesn't have the correct .fill distribution if subviews are UIButtons created with UIButton.Configuration. In the example below I created two UIStackView with subviews of UIButton type....
Petro Shm's user avatar
  • 351
0 votes
1 answer
47 views

UITextField backspace not working correctly for the first placeholder in a 6-digit verification code input in Swift

I am building an iPhone app where users can enter a 6-digit verification code, each digit in a separate UITextField. The UI is created programmatically with UIStackView to arrange the text fields ...
TheGuyWhoCantCode123's user avatar
-2 votes
1 answer
35 views

Whats element can I change to replace UIStackView to show 2 images row

I use a vertical UIStackView to show images in my iOS app just like the image below But now I need to change that behaviour and show two images per row just like the example below. What UI component ...
fabiobh's user avatar
  • 777
0 votes
1 answer
75 views

UIButton with configuration gives incorrect intrinsic content size, when not connected to debugger

We create a UIButton by initialising it with a configuration and embedding it within a (horizontal) UIStackView. We set setContentHuggingPriority to required because we want the button to only take up ...
Birgit Van Keer's user avatar
0 votes
1 answer
48 views

multilevel uistackviews autolayout not working

I'm trying to build a layout using this idea: scroll -> UIStackView (vertical) -> UIStackView (horizontal) -> UIStackView (vertical) [ view + n(UIStackView (horizontal)-> UIStackView (...
Matheus Cavalcante Teixeira's user avatar
1 vote
1 answer
34 views

UIStackView spacing seems very small

I'm trying to brush up on my UIKit and I can't figure out why my stack view spacing is so small when trying to add some custom views inside it. I've tried this stack view size on some of my past ...
Simon McNeil's user avatar
0 votes
3 answers
53 views

Issue with Flipping Views in UIStackView based on Condition

In my iOS project, I'm working with a UIStackView that contains multiple subviews. I want to dynamically flip or move up and down specific views within the stack view based on a condition. ...
DRN's user avatar
  • 155
0 votes
0 answers
47 views

iOS - Resize StackView according to Container view's height

I am developing a complex UI which comprises of multiple parts. So, I have opted to use Container Views. I have a tableView inside the containerView, and containerView is inside a stackView in parent ...
iOS's user avatar
  • 3,616
0 votes
1 answer
43 views

UIStackView - Hide/Unhide animation not as expected

I am trying to perform smooth animation when hiding and unhiding UI elements in a vertical StackView. When the UI element has height constraint set, I am unable to obtain expected result. The view ...
iOS's user avatar
  • 3,616
5 votes
3 answers
244 views

Why is the trailing of my UISwitch sticking out the UIStackView?

I don't know if this is a Swift bug or if I made a mistake, but there is a weird behaviour. I have a UILabel and a UISwitch inside a horizontal UIStackView, but the trailing of the UISwitch is cut off ...
Fabian R.'s user avatar
1 vote
1 answer
120 views

How to right align a UIStackView inside a UIScrollView when the stack view's size is smaller than scroll view?

Please look at the below picture of my storyboard to understand the layout of my views. On the left side is a horizontal UIStackView with 2 buttons. This is okay. On the right side of the above stack ...
sudoExclamationExclamation's user avatar
-1 votes
2 answers
92 views

Why is my UIView list not visible in my UIStackView and UIScrollView?

I have been messing with this code for a while. My UIViews are not showing up after looping through. I have tried this with out constraints, and the result was each of the UIViews were being rendered ...
RobloxHero's user avatar
0 votes
0 answers
73 views

Displaying stack view not from top

Struggling on this question second day. I am facing problem with displaying stack view into scroll view. My main problem is that when I open detail view with content it starts to display all ...
olehart's user avatar
1 vote
0 answers
42 views

Self sizing table view cell not resizing

I am trying to create a self sizing tableview cell with stack view, but the data get shrinked, is there any better way to achieve this. For Stack view Distribution: Fill Proportionally also I added ...
jerfin's user avatar
  • 893
-1 votes
3 answers
201 views

StackView with Labels on the ends

Is it possible to have a stack view with two labels in it, but instead of being trailing or leading aligned, the labels are aligned to the edges? Thanks.
Rik's user avatar
  • 1,967
0 votes
1 answer
84 views

Custom stack view alignment

import UIKit import TinyConstraints final class CountDownStackView: UIStackView { func configure(withData data: [[String]]) { data.forEach { rowData in let ...
Murat Can Çiçek's user avatar
0 votes
1 answer
182 views

How can I arrange calculator buttons in a grid layout within the Xcode15 user interface

I've created a StackView in Xcode 15 using ViewController to arrange the calculator buttons in a grid, but I'm encountering an issue where the button sizes automatically shrink. This prevents me from ...
Wombat's user avatar
  • 3
0 votes
0 answers
42 views

TableView Cell doesn't occupy full TableView width

I have this tableView in my code which I've set to be have the same leading and trailing as the view which is in it. I can confirm through coloring the background that is working. Next I created a ...
Gabriel Santos de Souza's user avatar
0 votes
1 answer
195 views

I want to blur entire screen except one stack view

When my keyboard is showing, text inputs in stack view go up. Now I want to add a blur view behind this stack view. App has been started: I tried: let blurEffect = UIBlurEffect(style: .prominent) ...
Emir's user avatar
  • 11
0 votes
1 answer
432 views

How can I set the height of a horizontal stackview in Xcode 15?

I'm new to iOS development and I'm having issues with using stack views that doesn't seem to be an issue with earlier versions of Xcode or perhaps it's my process. If i have 4 objects on the screen ...
Christi Palme's user avatar
0 votes
2 answers
72 views

Right alignment of controls inside a horizontally oriented stackview in uistoryboard

I have a StackView (Card View) with vertical orientation, alignment and distribution are "Fill". Inside that I have a few more StackViews with horizontal orientation and a few other ...
Gith's user avatar
  • 25
0 votes
1 answer
13 views

When using size class-specific constraints, some items in a stack view are placed outside on re-install

So let's say you're using Xcode's storyboard and you're setting up size class constraints so you can have a unique layout for portrait and landscape mode. Your screen has a stack view with six ...
Juliana Nielson's user avatar
0 votes
1 answer
27 views

Stackview will not obey constraint

I have 4 vertical stacks (NameStack, EmailStack, PasswordStack, ConfirmPasswordStack) and one view (CreateAccountView) embedded in a another vertical stack (FormStack) which inside a view (FormView) ...
XmalevolentX's user avatar
-1 votes
1 answer
161 views

UIPageViewController inside a UIStackView or UITableView [closed]

I was trying to create an onboarding UI using UIKit and Storyboard. I had a requirement where some parts needed to be static / sticky and some parts had to scroll horizontally as the user swiped on ...
Shawn Frank's user avatar
  • 5,131
0 votes
1 answer
32 views

UIScrollView with UIStackView which resizes to fullfill the screen height

No code because everything is placed in xib. Structure: UIScrollView contains UIView (UIScrollView Scrollable Content Size Ambiguity) which contains UIStackView which contains a list of subviews. All ...
Gargo's user avatar
  • 1,381
0 votes
1 answer
33 views

Custom proportional spacing in UIStackView without of additional subviews?

I know that I can add transparent subviews to UIStackView and set their widths with constraints. The problem is if I want to hide some opaque subviews all the spaces between them remain (and I don't ...
Gargo's user avatar
  • 1,381
0 votes
0 answers
59 views

Last UIButton is unresponsive in UIStackView

I have programmatically added UIStackView to the UIViewcontroller's view and added further buttons and labels as sub arranged view to stackview, but the last added button is not responding. override ...
Priyal's user avatar
  • 877
1 vote
2 answers
48 views

Weird behaviour of StackView with a label, image view and button inside it

I've a stack view with label, image view and button inside it. This stack view is configured for vertical axis with distribution and alignment set to fill. The label is not aligning to centre of the ...
Sachin's user avatar
  • 23
1 vote
1 answer
73 views

Issues with dynamic height UIStackView using autolayout

I am trying to create a horizontal axis UIStackView with 2 views, a label and an image, that would look something like this: Blue is the label Image is the image The frame of the UIStackView is the ...
Shawn Frank's user avatar
  • 5,131
-1 votes
2 answers
431 views

UIStackView does not respect size of programmatically added buttons

I have a UIStackView that includes either three or four custom UIButtons. All buttons are completely rounded, the left and right buttons are slightly bigger than the center one/two. Somehow, I can't ...
cameloper's user avatar
  • 306
0 votes
1 answer
71 views

insertSubview() is working on one UIView in UIStackView, But not on adjacent view

I am working on autolayouts in storyboard, I have two adjacent UIViews in a single UIStackView. I need to insert image in both UIView background. Problem is that background image is showing in left ...
Muhammad Haroon Iqbal's user avatar
1 vote
2 answers
1k views

Add views to UIStackView and have them shrink in width of the screen width runs out

I have a UIStackView in storyboard like this: @IBOutlet weak var stackView: UIStackView! I want to be able to add views to this UIStackView programmatically like this: let view = UIView(frame: ...
BlueBoy's user avatar
  • 856
0 votes
2 answers
232 views

How to create a grid of 3xInfinity items in Swift

I am trying to create a grid of 3xInfinity items in Swift with same size items. The items are square buttons that can be aligned up to 3 items wide and infinite on the Y axis. I have created a ...
José Luna's user avatar
0 votes
1 answer
42 views

Random errors when embedding UILabel in UIView inside UIStackView

One UILabel is placed directly into UIStackView the second UILabel is the same but embedded in another UIView: I need >= constraint due to some more complex layout but I simplified the example. ...
Gargo's user avatar
  • 1,381
0 votes
1 answer
62 views

Is there an easy & flexible way to set intrinsic size for UIViews?

(I'm posting this question as S.O. ("Answer your own question") format to make this recipe easy to find, and to get any other helpful perspectives). Question: What is a convenient way to ...
clearlight's user avatar
  • 12.6k
0 votes
1 answer
75 views

Updating slider position in a custom TabBar when device orientation changes in iOS with UIKit

I'm trying to create a custom TabBar with a slider that has the same width as the buttons inside it. The slider should change color and position based on the index of the button pressed within the ...
WebStormer's user avatar
0 votes
1 answer
594 views

UIStack of UIButton dynamic size / height according to title

I have UITableview with custom cells. In each cell I have on one side a vertical UIStack view of UIButtons. The number of the buttons per stack varies per cell. As part of the code for the cell I ...
Nicholas Farmer's user avatar
1 vote
1 answer
2k views

How to set space in stackview, like Spacer in SwiftUI?

How can I give spacing like Spacer in SwiftUI in stackview, not exact spacing? private lazy var stackView: UIStackView = { let stackView = UIStackView() stackView....
Abrcd18's user avatar
  • 185
7 votes
1 answer
3k views

Inserting UIHostingController with changeable height into UIStackView

I have an issue where I'm trying to insert a SwiftUI view into an existing UIKit view. The SwiftUI view can change height dynamically, but the UIStackView does not adjust to the new size. I've created ...
DevB1's user avatar
  • 1,495
1 vote
1 answer
246 views

Layout issue with UIStackView with distribution .fillEqually is ignoring spacing

I have a layout issue I'm struggling to fix. I have a stack view in a tableview cell and I am trying to programmatically add images with different layouts based on the number of images. There's one ...
CristianMoisei's user avatar
-1 votes
1 answer
313 views

UIStackView items width issue in iOS 15.0

I have two items inside the stackView, width for both the items(Buttons) depends on the text size with horizontal scroll. In iOS 15.5+ devices its working fine where as in below 15.5 its width ...
OhStack's user avatar
  • 116
-1 votes
1 answer
88 views

ContentHuggingPriority and CompressionResistance not honored by StackView with custom control as subview

I've created a horizontal UIStackView with two subviews: A UILabel. A custom UIControl. I would like the Label to expand within the view and for the Control to hug its content. Content Hugging ...
SemperFly's user avatar
  • 1,583
0 votes
1 answer
109 views

Need constraints for Y position or height, but height is determined by labels

I have a custom view with nested stack views and labels, I believe I have enough constraints to not cause an error, however, I suspect the interface builder might be losing the label defining the ...
naaaaaa's user avatar
1 vote
3 answers
832 views

UILabel not clickable in stack view programmatically created Swift

My question and code is based on this answer to one of my previous questions. I have programmatically created stackview where several labels are stored and I'm trying to make these labels clickable. I ...
Andrew's user avatar
  • 2,147

1
2 3 4 5
30