ios 13 панель навигации не просвечивает вместе со строкой состояния - PullRequest
1 голос
/ 20 февраля 2020

Я попытался реализовать свой собственный вид навигации в swiftui. Но статус выглядит не полупрозрачным, как панель навигации.

enter image description here

С .edgesIgnoringSafeArea(.top) он работал как я ожидал.

image.edgesIgnoringSafeArea">

Но мне интересно, что не так с моим пользовательским представлением, чтобы это произошло.

struct ExampleNavigationView<Content: View>: UIViewControllerRepresentable {
    private var content: () -> Content

    init(@ViewBuilder content: @escaping () -> Content){
        self.content = content
    }

    func makeUIViewController(context: Context) -> UINavigationController {
        let contentViewController = UIHostingController(rootView: content())
        let navigationController = UINavigationController(rootViewController: contentViewController)
        navigationController.navigationBar.prefersLargeTitles = false
        contentViewController.navigationItem.title = "Search"
        return navigationController
    }

    func updateUIViewController(_ uiViewController: UINavigationController, context: UIViewControllerRepresentableContext<ExampleNavigationView>) {}
}

...