I just created a new Xcode project, and only selected portrait orientation, but when I rotate my iPhone, it shows the landscape view as well. Any idea why?
Watch this: https://imgur.com/a/CXk02KL
iPhone Version 15.0 | Xcode Version 13.0
Post
Replies
Boosts
Views
Activity
I have a simple tabView, and when I change the orientation of my iPhone (from portrait to landscape) tab jumps one tab back. For example, if you are on page 2 and rotate your device, it goes to 1, but it should stay on page 2. Why this unwanted jump happens? Am I missing something?
(The weird thing about this issue is when you turn the device back to portrait (from landscape), it doesn't jump.)
struct ContentView: View {
@State var currentPage: Int = 1
var body: some View {
ZStack {
TabView(selection: $currentPage) {
Text("1").tag(0)
Text("2").tag(1)
Text("3").tag(2)
}
.indexViewStyle(PageIndexViewStyle(backgroundDisplayMode: .never))
.tabViewStyle(PageTabViewStyle())
}
}
}
I'm running the latest iOS and Xcode version.