0

Can you please tell me if there is a way to scroll through wide pictures normally? Without scrolling the part that doesn't fit on the screen?

Here is an example code:

import SwiftUI

struct ContentView: View {
    var body: some View {
        TabView {
            a_View()
            b_View()
        }
        .ignoresSafeArea()
        .tabViewStyle(.page)
    }
}

struct a_View: View {
    var body: some View {
        Image("Image1")
            .resizable()
            .scaledToFill()
            .ignoresSafeArea()
    }
}

struct b_View: View {
    var body: some View {
        Image("Image2")
            .resizable()
            .scaledToFill()
            .ignoresSafeArea()
    }
}

Here is a link to screen recording for clarity and both sample images in the attach:

screen recording

Image1

Image2

1 Answers1

0

The solution:

struct a_View: View {
    var body: some View {
        Image("AuthImage1")
            .resizable()
            .scaledToFill()
            .frame(width: UIScreen.main.bounds.width)
            .clipped()
            .ignoresSafeArea()
    }
}
  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jul 07 '23 at 10:20