When checking our app for bugs on iOS 16 we have realized that behavior on the NavigationBar changes, even on non 14 Pro models. There are multiple issues and we are wondering how to fix them. All issues came with no change in code. Just running the app on iOS 16.
We are using UIHostingControllers to wrap all our SwiftUI views. Maybe there's some issue here.
It seems like the UIHostingController
and SwiftUI clash a bit on iOS 16. iOS gets confused when setting properties on the ViewController that also can be set via SwiftUI. Try to set the title and title style in your root SwiftUI view that you put into the HostingController:
var body: some View {
yourContentViewsHere
.navigationTitle("NavBar title")
.navigationBarTitleDisplayMode(.inline)
}
All of the issues in the question should get resolved by this fix.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.