Thursday, June 13, 2024
HomeiOS Developmentios - cannot get my navbar to the highest, retains having an...

ios – cannot get my navbar to the highest, retains having an area above or stretches


import SwiftUI

struct UtilitySelectionView: View {
    var physique: some View {
        NavigationView {
            GeometryReader { geometry in
                ZStack {
                    // Background shade
                    Shade.black
                        .edgesIgnoringSafeArea(.all)
                    
                    VStack(spacing: 0) {
                        // Protected space shade
                        Shade.black
                            .body(top: geometry.safeAreaInsets.high)
                            .edgesIgnoringSafeArea(.high)
                        
                        // Navbar part
                        Navbar()
                            .offset(y: -geometry.safeAreaInsets.high - 2)
                        
                        Spacer()

                        // Centered Content material
                        VStack {
                            Textual content("Select your Utility")
                                .font(.largeTitle)
                                .foregroundColor(.yellow)
                                .padding(.backside, 20)

                            HStack {
                                NavigationLink(vacation spot: ARSelectionView(utility: .sdge)) {
                                    Picture("d_logo")
                                        .resizable()
                                        .aspectRatio(contentMode: .match)
                                        .body(width: 80, top: 80)
                                        .background(Shade.white)
                                        .clipShape(RoundedRectangle(cornerRadius: 15)) // Rounded edges
                                        .padding(10)
                                }
                                NavigationLink(vacation spot: ARSelectionView(utility: .sce)) {
                                    Picture("s_logo")
                                        .resizable()
                                        .aspectRatio(contentMode: .match)
                                        .body(width: 80, top: 80)
                                        .background(Shade.white)
                                        .clipShape(RoundedRectangle(cornerRadius: 15)) // Rounded edges
                                        .padding(10)
                                }
                                NavigationLink(vacation spot: ARSelectionView(utility: .pge)) {
                                    Picture("e_logo")
                                        .resizable()
                                        .aspectRatio(contentMode: .match)
                                        .body(width: 80, top: 80)
                                        .background(Shade.white)
                                        .clipShape(RoundedRectangle(cornerRadius: 15)) // Rounded edges
                                        .padding(10)
                                }
                            }
                        }
                        .padding(.high, 10) // Regulate the padding as mandatory

                        Spacer()
                    }
                }
            }
            .navigationBarHidden(true) // Conceal the default navigation bar
        }
    }
}

i attempted padding, offsets, and different positioning technieques, i believe perhaps my format is off? I’m simply trying to see methods to transfer it up with out stretching out the navbar, so the Hstack that has the picture horizontal button and mangifying glass in it’s the navbar that I would like to switch and transfer upwards –



Supply hyperlink

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments