Tabview в альбомной ориентации полный экран - PullRequest
2 голосов
/ 30 октября 2019

Я работаю над TabView, но я хочу показать изображение, которое занимает весь экран и остальное содержимое обычным способом.

В вертикальном режиме это работает правильно, но в горизонтальном режимечасть содержимого кусает эту метку.

Как я могу это исправить?

Мой код выглядит следующим образом:

ContentView.swift

struct ContentView: View {
    @State private var selection = 0

    var body: some View {
        TabView(selection: $selection){
                Home()
                .tabItem {
                    VStack {
                        Image("first")
                        Text("First")
                    }
                }
                .tag(0)
            Text("Second View")
                .font(.title)
                .tabItem {
                    VStack {
                        Image("second")
                        Text("Second")
                    }
                }
                .tag(1)
        } .edgesIgnoringSafeArea(.top)
    }
}

Home.swift

struct Home: View {
    var body: some View {

        GeometryReader { geometry in
            ZStack {
                Color(.red)
                    .edgesIgnoringSafeArea(.all)

                ScrollView {

                    VStack {
                        Image("slider_concierto1")
                            .resizable()
                            //.edgesIgnoringSafeArea(.all)
                            .frame(height: 250)
                            .aspectRatio(contentMode: .fit)

                        VStack {

                            Text("Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.")
                        }

                        .padding()
                            //.frame(minWidth: 0, maxWidth: .infinity, alignment: Alignment.topLeading)
                            .background(RoundedRectangle(cornerRadius: 16) .foregroundColor(Color.green))
                            .padding()

                    }

                    .frame(width: geometry.size.width)

                } //scrollview

            } //GEO


        }//geo
            .edgesIgnoringSafeArea(.all)
    }
}

View image

...