У меня есть вид, который я нажимаю туда, где я установил прозрачную панель навигации, и по причинам макета я установил один из подпредставлений до -180 пунктов. Когда я прокручиваю, я не хочу, чтобы панель навигации менялась на полупрозрачный черный, я хочу, чтобы она оставалась невидимой. Как мне это сделать?
var body: some View {
ScrollView {
VStack(alignment: .center) {
// some views, not important
}
.background(SwiftUI.Color.white)
.foregroundColor(.black)
.padding(.top, -180)
}
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .topLeading)
.navigationBarItems(
leading: self.centeredButton(systemName: "arrow.left", action:dismiss),
trailing: self.centeredButton(systemName: "square.and.arrow.up", action: { })
)
}
private func transparentNavBar() -> NavigationConfigurator {
return NavigationConfigurator { nc in
nc.navigationBar.barTintColor = .white
nc.navigationBar.setBackgroundImage(UIImage(), for: .default)
nc.navigationBar.shadowImage = UIImage()
nc.navigationBar.isTranslucent = false
}
}
///9169768/swiftui-obnovlyaet-tsvet-zagolovka-paneli-navigatsii
struct NavigationConfigurator: UIViewControllerRepresentable {
var configure: (UINavigationController) -> Void = { _ in }
func makeUIViewController(context: UIViewControllerRepresentableContext<NavigationConfigurator>) -> UIViewController {
UIViewController()
}
func updateUIViewController(_ uiViewController: UIViewController, context: UIViewControllerRepresentableContext<NavigationConfigurator>) {
if let nc = uiViewController.navigationController {
self.configure(nc)
}
}
}