1

I created the NavigationBar, but when I perform .inline, I cannot make the background color completely black. Do you have any information on this? I could not find how to do it. I would be glad if you could fix this. likewise tabBar also have this color problem I tried different ways but got the same result in all of them.

enter image description here

init() {
    //Tabbar Renk bölümü
    UITabBar.appearance().barTintColor = UIColor.black
    UINavigationBar.appearance().barTintColor = .black
}

HStack(spacing: 10) {
    NavigationLink(destination: PicturePage()) {

        Text("Picture")
            .font(.title)
            .foregroundColor(Color(#colorLiteral(red: 0.7239437103, green: 0.2440972626, blue: 0.4727140069, alpha: 1)))
            .frame(maxWidth: geometry.size.width)
            .frame(height: geometry.size.height / 5)
            .overlay(
                RoundedRectangle(cornerRadius: 10)
                    .stroke(Color(#colorLiteral(red: 0.8527825475, green: 0.821311295, blue: 0.8959596753, alpha: 1)), lineWidth: 3)
            )


    }.navigationBarTitle(Text("Geri"),displayMode: .inline)
    .navigationBarHidden(true)
}

struct PicturePage: View {
    //3-1//
    var body: some View {
        GeometryReader { geometry in
            Color.black.edgesIgnoringSafeArea(.all)
            VStack {
                VStack {
                    Text("Picture")
                        .font(.system(size: 60))
                        .frame(height: geometry.size.height / 10)
                        .foregroundColor(.init(red: 45 / 255, green: 0 / 255, blue: 112 / 255))
                    Spacer().frame(height: geometry.size.height / 15)
                }

                VStack {
                    Text("Merhaba").frame(width: geometry.size.width, height: geometry.size.height / 10)
                        .foregroundColor(Color.white)
                }
                VStack {
                    Image("AstroGirl").resizable()
                        .aspectRatio(contentMode: .fit)
                        .frame(width: geometry.size.width, height: geometry.size.height / 3)
                    Spacer().frame(height: geometry.size.height / 15)
                }
                // This `HStack` is changed
                HStack(spacing: 30) {
                    ForEach(0 ..< 3) { _ in
                        CircleView()
                            .frame(width: geometry.size.width / 5, height: geometry.size.height / 10)
                            .shadow(color: Color.yellow, radius: 10, x: 0, y: 0)
                    }
                }
                Spacer().frame(height: geometry.size.height / 10)
                VStack {
                    Button(action: {}, label: {
                        Text("Gönder")
                            .frame(width: geometry.size.width / 3, height: 50)
                            .padding(10)
                            .font(Font.system(size: 30, weight: .medium, design: .serif))
                            .foregroundColor(.white)
                            .background(RoundedRectangle(cornerRadius: 30))
                            .foregroundColor(.init(red: 45 / 255, green: 0 / 255, blue: 112 / 255))

                    })
                }
            }

        }
    }
}
Witek Bobrowski
  • 3,749
  • 1
  • 20
  • 34
GurkanEsen
  • 149
  • 2
  • 11
  • Does this answer your question? [How change background color if using NavigationView in SwiftUI?](https://stackoverflow.com/questions/56923397/how-change-background-color-if-using-navigationview-in-swiftui) – lorem ipsum Dec 28 '20 at 02:29
  • You have to change each of the appearance types `navigationBar.standardAppearance = standard`, ` navigationBar.compactAppearance = compact`, `navigationBar.scrollEdgeAppearance = scrollEdge` – lorem ipsum Dec 28 '20 at 02:31

0 Answers0