Questions tagged [zstack]
68 questions
0
votes
0 answers
Rotation issue in ZStack - SwiftUI
Here , I'm trying to apply same rotation in both these elements.But these object or elements are doing un wanted behaviour, they are not rotating as same as others . So I want to rotate them all as same , So that no the blue card gets behind the…

dipon_the_pro_coder
- 25
- 6
0
votes
1 answer
SwiftUI - How can set a boundary for elements in ZStack
In my example image you can see that the "World" text can be moved (drag) outside the image area. It is positioned below the Add Sticker button. This element is in a ZStack. So I don't want my text element to go outside the image area. I tried…

dipon_the_pro_coder
- 25
- 6
0
votes
1 answer
SwiftUI: Arrange middle layer in ZStack dependent on top layer
I would like to implement a UI, which has
a background image, which is fullscreen and scales with the device size
a gradient above the background image and below the main UI, which is aligned bottom and it's size is dependent of the positioning of…

FrankZp
- 2,022
- 3
- 28
- 41
0
votes
1 answer
How to fix padding in ZStack
I have ZStack with two views one of which can be shown due to the condition:
ZStack{
VStack{
...
}.padding(.all,17)
if handler.bottomVisible {
BottomSheetView(handler:…

Andrew
- 1,947
- 2
- 23
- 61
0
votes
1 answer
How to reverse SwiftUI ZStack order?
trying to recreate a next/previous item on a stack of cards. I have my cards in a ZStack. The problem I’m having is that by default ZStack are in reverse order (first item in array is at the bottom of the stack).
Here’s what the code looks like at…

Ronni
- 55
- 1
- 7
0
votes
1 answer
onTapGesture does only partially work on a ZStack
I have build a ZStack containing an image, an overlay and a systemImage. I want to open a sheet when the user taps on this image but it only works when the user clicks on a very specific point on the very bottom of the ZStack. Does anyone know how I…

chrispsv
- 503
- 1
- 3
- 21
0
votes
1 answer
How to put an element in front of a ForEach with a ZStack without making it overlapped
I am trying to create a layout in which there is a list of elements, and a button to add more elements in front of it. I know I could put it in the navigation bar, but that's not the graphic look I'd like to achieve. However, if I put those two…

Pandruz
- 345
- 5
- 18
0
votes
1 answer
How to align the subviews next to the leading edge of widget, but not to the background image in ZStack?
The image is larger than the widget frame size, and its proportion is 16:10.
The problem is, for subviews in ZStack when under small widget size, both the image(as background) and views above image, are not aligned to the widget itself, but exceed,…

stephen
- 519
- 6
- 22
0
votes
2 answers
How to push a view to the top of a ZStack?
So, basically im creating a HeaderView that consists of a ZStack that takes the entire screen space since it adds a pure black background and the entire header which sits on the black background (hence the need for a Zstack). Everything looks how I…

Alejo
- 47
- 1
- 10
0
votes
1 answer
Result of 'Zstack' initializer is unused
I'm a beginner (started a week ago) in SwiftUI and trying out different things with app development. I'm stuck with Zstack not being able to execute anything.
This is multiplatform app, and when I simulate it, it's just blank white space.
When I…

Jon Lee
- 1
0
votes
1 answer
Show color on full screen in SwiftUI
I'm trying to show red color in full screen.
If I use edgesIgnoringSafeArea(.all) the screen automatically becomes scrolling enabled, which I don't want. Can you please advise me how to show red color on full screen without scrolling and without…

Sham Dhiman
- 1,348
- 1
- 21
- 59
0
votes
1 answer
Aligning Text within ZStack based on rotation in SwiftUI
I'm having some trouble aligning Text inside a ZStack...more specifically, if I rotate the device after I started the app...
I want the Text to be aligned to the top leading of the View, but below you can see images of what's happening...
If I open…

pierofrezza
- 59
- 8
0
votes
1 answer
GeometryReader and ZStack to product screenshot
My goal: To use geometry reader and a screenshot function (already written) to grab just the small portion of an image that falls behind a close button.
Setup: I have a ZStack with an Image and a smaller button overtop of it (it is a system image…

Caleb Rudnicki
- 345
- 8
- 17
0
votes
1 answer
Tappable Image in a ZStack with a Button
I have a ZStack with an image and a close button overlaying it. I cannot make the image tappable with the button overlaying it.
ZStack(alignment: .topTrailing) {
NetworkImage(url: article.imageURL)
…

Caleb Rudnicki
- 345
- 8
- 17
0
votes
2 answers
SwiftUI didn't update the view while observedObject changed
I'm doing a login and display data application. While the user login, the data will be displayed correctly. While I logout and login another account, the data supposed to be update by the observedObject which call the function to be reload the data.…

SAS231
- 175
- 4
- 17