【发布时间】:2020-03-19 12:27:09
【问题描述】:
我正在尝试设置状态栏的背景颜色以使其与导航栏颜色对齐。在 UIKit 中,我会在它下面放置一个视图。在 SwiftUI 中,我尝试使用 ZStack,但大标题不再起作用。
所以这是我目前没有绿色状态栏的工作状态:
var body: some View {
NavigationView {
ScrollView {
Text("Lol 123 Lol")
.foregroundColor(Color.secondary)
.padding([.top, .bottom], 16)
.padding([.leading,.trailing], 16)
TwoTextFieldsView(isSecondSecure: true,
firstTextFieldText: username,
secondTextFieldText: password,
firstTextFieldPlaceholder: "Username",
secondTextFieldPlaceholder: "Password")
.padding([.leading,.trailing, .bottom], 16)
}
.navigationBarTitle("Connect to Lol")
.onTapGesture {
self.hideKeyboard()
}
}
}
它看起来像:
【问题讨论】:
-
不,如果我使用
.inline而不是.largeTitle,这个例子才有效。如果我使用largeTitle- 向上滚动并且标题变小 - 手势不再起作用。 -
你有什么解决办法吗?
-
有什么解决办法吗?
标签: ios swift uinavigationbar swiftui statusbar