Questions tagged [zstack]
68 questions
2
votes
0 answers
SwiftUI if condition in ZStack
I have a simple view in SwiftUI. There's a variable called connectionState. It's set to true for testing.
@State var connectionState: Bool = true
@ViewBuilder
var body: some View {
ZStack(alignment: .bottomTrailing) {
if…

Alexander Hill
- 33
- 4
1
vote
1 answer
How can I combine two half view with zstack in SwiftUI?
I have a map pin view that represents an action.
This is the code
VStack {
ActionView(action: place.actions.first!)
.frame(width: 35, height: 35)
…

n savoini
- 422
- 1
- 3
- 13
1
vote
2 answers
Unexpected layout issues with SwiftUI Image and ZStack
I'm trying to create a view composed of two parts - the top part is an image with a piece of text overlaid in the top left corner. The top part should take up 2/3 of the height of the view. The bottom part is text information and a button, contained…

soleil
- 12,133
- 33
- 112
- 183
1
vote
1 answer
SwiftUI combine views with Stack
I am trying to create a design like this using text and image in a ZStack but my current implementation isn't showing the text at all, and I don't know why
ZStack {
Text("15")
.frame(alignment:…

tHatpart
- 1,302
- 3
- 12
- 27
1
vote
1 answer
Stacking a HStack below a ZStack in SwiftUI
Disclaimer: New to SwiftUI
I know a ZStack() view allows me to overlap views, which is what I want for the heading section of the app.
I set the ZStack() to not take up the entire height and had expected an HStack(), placed after the ZStack() to do…

Dan
- 2,304
- 6
- 42
- 69
1
vote
1 answer
Color in ZStack not behaving properly
so I'd like to lay a Color at the top of a ZStack over another view. The reason I don't want to use overlay is the Color is going to have a tap gesture attached to it. A minimal reproducible example is below. Essentially, I want the Color.secondary…

nickcoding2
- 142
- 1
- 8
- 34
1
vote
1 answer
SwiftUI: Frame modifier in ZStack affecting other views
struct CircleTestView: View {
let diameter: CGFloat = 433
var body: some View {
ZStack {
Color(.yellow)
.ignoresSafeArea()
VStack {
Circle()
…

Grambo
- 887
- 8
- 25
1
vote
1 answer
How can I show in SwiftUI a screen in different screen sizes with the same measures?
I’m having problems with my app with different screen sizes. I made a little example to show the problem.
I have a screen with a text and a button on the left and an image on the right. Behind this, in zstack, I have the same image bigger and a…

Ivang
- 105
- 8
1
vote
1 answer
Saving .tif Image Incorrectly using Python3 and imageio
I am trying to save an altered z-stack .tif file in Python3. Here's my code where I checked that the the functions worked as intended.
#libraries
import imageio as ii
#import initial image
fname='101_nuc1syg1.tif'
adata = ii.volread(fname)
#check…

billyl320
- 62
- 1
- 9
1
vote
1 answer
SwiftUI, using ForEach inside ZStack causes screen flickering
when calling router1(), there is quick (white screen) flickering
when calling router2(), no flickering
NOTE: in both cases navigationLevelsStack just has 1 element
It seems it just depends on the fact that router1() uses a ForEach?
Is there a way…

Daniele B
- 19,801
- 29
- 115
- 173
1
vote
0 answers
Alignment In SwiftUI
I'm new to SwiftUI. I'm designing a widget for size systemMedium.
I'm getting stuck in spacing,
If I reduce the size of the Violet Container, Then the rest UI is not aligning properly
Here is My Code
case .systemMedium:
ZStack {
…

ManjunathK
- 65
- 1
- 6
1
vote
1 answer
How to remove extra space between SwiftUI List and NavigationBar
I would like to know how to remove the extra space between SwiftUI List and NavigationBar. Kindly see photo below for reference.
Note that I tried adding top padding -> .padding (.top,-100) in NewsHomeView but its not a good solution because on…

Josh Byanec McFergan
- 441
- 8
- 21
1
vote
3 answers
SwiftUI: ZStack with scaleEffect - how to align scaled image to bottom?
I have a ZStack in which an Image is presented.
The image needs to be scaled in some cases.
I am failing on aligning the scaled image on the bottom of the ZStack, it is always presented in the middle.
I tried ZStack(alignment: .bottom) in…

Nathanael Tse
- 171
- 13
1
vote
1 answer
How to layout properly in ZStack (I have visibility problem)?
Here is reproducable small code below;
As you'll see when you run the demo code, the Element view does stay under Color.blue when dragged eventhough its above according to ZStack. By the way I also played with zIndex modifier but still no luck. Any…

Enes Karaosman
- 1,889
- 20
- 27
1
vote
1 answer
How to Crop Stacks in ImageJ without first Duplicating
I am using imageJ for automated microscopy of live cells.
The microscope centers the stage on a desired cell, takes a Z-stack, and passes this stack to imageJ.
I want to then use Analyze Particles to output the area of the cell in each Z-slice.…

dlight
- 29
- 3