2

in my Projekt I have a ScrollView with some elements. When I am scrolling the elements should perform a 3DEffect. Everything works fine, but the edges of the Element (a VStack) are cut off.

At the bottom the edges are cut off.

Does anybody know the problem?

Here is my code of the ContentView():

var body: some View {
    NavigationView{
        ZStack {
            VStack{
                ScrollView(showsIndicators: false){
                    VStack(spacing: 30) {
                        ForEach(0..<4){ item in
                            GeometryReader { geometry in
                                Elemente(minY: geometry.frame(in: .global).minY, title: self.möglicheZeiten[item < self.möglicheZeiten.count ? item : 0], einstellungsFeld: item )
                            }
                            .frame(maxWidth: .infinity)
                            .frame(width: 350, height: 200)
                        }
                    }
                }
                NavigationLink(destination: TrainingView()){
                    Text("Start")
                }
                .styleButton()
            }
            .navigationBarTitle("Workout", displayMode: .automatic)
        }
    }
}

And here is the code of the Element():

var body: some View{
var minY: CGFloat

...

VStack {
    VStack(spacing: 20){
        Text("\(title)")
            .bold()

        if einstellungsFeld != 3{
            Zeiten(minuten: daten.berechneMinuten(minuten: Int(wert)), sekunden: daten.berechnenSekunden(sekunden: Int(wert)))
        }else{
            Text("Durchgänge: \(Int(daten.durchgaenge))")
        }
        Slider(value: $daten.insgesamt)
    }
    .styleSettingsBox()
    .rotation3DEffect(Angle(degrees: Double(minY/10)), axis: (x: 10, y: 0, z: 0.0))
    .scaleEffect(minY < 1.00 ? minY / 1000 + 1 : 1.00, anchor: .bottom)

}

}

Thanks in advance and sorry for my English :)

1 Answer 1

1

I solved it by giving the Vstack in the ScrollView a .frame(maxHeight: .infinty).

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.