Questions tagged [vstack]

A Swift UI view that arranges its children in a vertical line.

193 questions
1
vote
1 answer

Get perfect alignment and content measurements of HStack and VStack

I'm trying to insert 3 rectangles inside my scrollView precisely 2 horizontally and 1 vertically. I need all three rectangles to respect the same width. Horizontally everything works fine and adapts to all devices instead of the single rectangle…
kAiN
  • 2,559
  • 1
  • 26
  • 54
1
vote
1 answer

isssue with ZStack and list

I have a RocketView View to view SpaceX rockets with the SpaceX API. I have an issue with ZStack or VStack in the RocketCell View where the cell is not showing the whole image in the list. How can I make it so that the entire image is displayed? …
NinjaDeveloper
  • 1,620
  • 3
  • 19
  • 51
1
vote
1 answer

Why there is a padding beneath a text in swiftUI when i have applied none? is this a bug or a feature?

I have a simple layout, a VStack that has two children a Text and another HStack. and very weirdly SwiftUI applied a large padding beneath the text. and more weirdly the way to solve it is to add a padding but i have to set it to 0.1. this will…
Enos
  • 100
  • 1
  • 7
1
vote
1 answer

Aligning toggles in a SwiftUI View

I have this code that contains the labels and toggles shown in the screenshot below VStack(alignment: .leading) { HStack() { Text("Autostart:") .font(.custom("SFProText-Medium", size: 12)) …
narner
  • 2,908
  • 3
  • 26
  • 63
1
vote
2 answers

SwiftUI mutilple line text not handling/alinging properly in Vstack

I'm facing alignment issue when text input is multiple lines. In this example, first image shows left and right side text is properly shown. second image, it shows when we long text it takes 3 to 4 lines which disturb alignment on the left and right…
EN_Tech
  • 67
  • 6
1
vote
2 answers

Make two buttons equal height and width in HStack

I have one VStack and another HStack with buttons inside. I faced problem with shrinking buttons based on their content even though I tried to set fixed width and height of Buttons. Here is the main screen: import Foundation import SwiftUI import…
1
vote
0 answers

SwiftUI - grid with irregular rows

I'm trying to create the following grid format in SwiftUI: For context, this is a row in a basket. I'm trying to use a LazyVGrid and so far have the following column layout defined: let columns = [ GridItem(.flexible()), …
DevB1
  • 1,235
  • 3
  • 17
  • 43
1
vote
1 answer

How to use a for each loop to iterate only over the even or odd indexes of an array in Swift

I have one array that I want to iterate over and make a button object for each element of the array. However, I want to have two VStacks that split these buttons up, essentially two columns with many rows of the text objects, but I want it to go…
TrappinNachos
  • 87
  • 1
  • 7
1
vote
0 answers

how to pad a set of numpy feature files to same shape?

I have a set of feature files in numpy format in a folder and would like to vstack them so i can add input_shape in my neural network, input_shape=(21,2048) . The numpy files as as in picture; The size of the np files are different, example: (16,…
1
vote
0 answers

HStack expand to entire Width & Equal Spacing

I'm trying a lot of different ways, using padding(), spacer(), frame() modifiers but can't get what I want. Essentially, I would like for the Stack to have a uniform Look w/ the same font sizes across all labels/values. As can see from the pic, the…
app4g
  • 670
  • 4
  • 24
1
vote
2 answers

Align Top In SwiftUI HStack

I am trying to align an image in the top of an HStack, but when the text is multiple lines the image gets centered. How can I align the second image with the top of the text? var infoView: some View { VStack(alignment: .leading, spacing: 16) { …
tHatpart
  • 1,302
  • 3
  • 12
  • 27
1
vote
1 answer

How to vstack multiple astropy tables using a loop

I have a list of astropy tables and I want to vstack them all using a loop. This is what I have: tables = [] for i in range(len(sortedfiles)): tables.append(openfits(sortedfiles[i])) which creates a list where each element is an astropy table. I…
ETsiak
  • 11
  • 1
1
vote
1 answer

SwiftUI - Label not aligning to left

I've got a very basic view with a label in it in SwiftUI and I'm struggling to get it to align to the left. This is what it is: VStack(alignment: .leading) { Label("Hi", ...) } .frame(maxWidth: .infinity) No matter what I've tried the label stays…
Nicolas Gimelli
  • 695
  • 7
  • 19
1
vote
2 answers

Center Elements in HStack

I am trying to implement a text field that is centered, but I cannot seem to do so. I tried doing it in 3 different ways, but it is still leading aligned. //Mobile Number Field HStack(alignment: .center) { …
Jacob F
  • 135
  • 3
  • 13
1
vote
1 answer

Make view in scroll view centered in available space between top vstack with labels (it can change)

I have scroll view in which on the top can be different number of texts, from zero to many. And in the center I have another view which should be vertically centered in AVAILABLE SPACE, so if we have no texts on the top - my view should be in the…