Fixing ZStack size issue.

This commit is contained in:
Maxime Delporte 2025-05-07 11:49:39 +02:00
parent c3c58b7b39
commit 53031289de
3 changed files with 10 additions and 8 deletions

View File

@ -13,3 +13,5 @@ The last one is the best for my needs.
The goal right now is to produce. The goal right now is to produce.
Some questions persist. Some questions persist.
Fix ZStack size : https://stackoverflow.com/questions/77969499/content-in-a-full-screen-zstack-not-centering-as-expected

View File

@ -12,14 +12,15 @@ struct ContentView: View {
@State private var capturedImage: UIImage? @State private var capturedImage: UIImage?
var body: some View { var body: some View {
ZStack {
if capturedImage == nil { if capturedImage == nil {
CustomCameraView(capturedImage: $capturedImage) CustomCameraView(capturedImage: $capturedImage)
.ignoresSafeArea() } else {
} else { PhotoPreviewView(capturedImage: $capturedImage)
PhotoPreviewView(capturedImage: $capturedImage) }
.ignoresSafeArea()
} }
.frame(maxWidth: .infinity, maxHeight: .infinity)
.ignoresSafeArea(edges: [.top, .bottom])
} }
} }

View File

@ -28,7 +28,6 @@ struct PhotoPreviewView: View {
.padding(.leading, 42) .padding(.leading, 42)
.padding(.top, 62) .padding(.top, 62)
} }
.ignoresSafeArea()
} }
} }
} }