Hello,
I have a SwiftUI View sitting in the UIHosting view controller. On rotation to landscape, the system would add padding to the toolbar. I presume it's the nav bar.
Anyone experienced this? What would be this space? padding? content margin?
Hello,
I have a SwiftUI View sitting in the UIHosting view controller. On rotation to landscape, the system would add padding to the toolbar. I presume it's the nav bar.
Anyone experienced this? What would be this space? padding? content margin?
Could you please file a feedback report and include a sample project. That would be helpful in understanding and investigating the issue.
Please post the Feedback ID number here once you do.
Here's an sample code that can produce the problem. It happens on rotate in simulator, only in iOS 26.*
Expectation: should have the same lead spacing regardless of the rotation of the device.
struct ContentView: View {
@State private var showingSharePopover = false
var body: some View {
NavigationStack {
VStack {
Button {
showingSharePopover = true
} label: {
Label("Show Share Options", systemImage: "square.and.arrow.up")
.font(.title2)
.padding(.vertical, 10)
.padding(.horizontal, 20)
}
.buttonStyle(.borderedProminent)
.tint(.indigo)
.controlSize(.large)
.shadow(radius: 5)
.sheet(isPresented: $showingSharePopover, content: {
})
}
.navigationBarBackButtonHidden(false)
.toolbar {
ToolbarItem(placement: .topBarLeading) {
Button {
} label: {
HStack {
Image(systemName: "square.and.arrow.left")
Text("Done")
}
}
}
}
.padding()
}
}
}
This NavigationBarPlatterContainer is hiding my inline title when using a large title that scrolls into the inline. Do we have a way around this issue?
Possibly the same root cause, seen from UIKit: a standalone UIToolbar gets extra leading padding when its left safe area inset comes from the view controller (additionalSafeAreaInsets.left, or the iPhone Duo vertical bar on the left). With a left inset of 84 pt the first item lands at ~200 pt instead of ~105 pt. The same inset on the right is handled correctly, and so is a window-level inset (Dynamic Island side in landscape).
Reproduces on iOS 26.5, 27.0 and 27.1 (Simulator and an iPhone 17 Pro Max), not on iOS 17.5 / 18.6. Pinning the toolbar to safeAreaLayoutGuide instead of the view's edges works around it.
Filed as FB25095941 with a sample project.