我有一个模态表,这是代码:
设置仪表板视图:
@State private var notificationsSettingsSheet = false
var body: some View {
Button(action: {
self.notificationsSettingsSheet.toggle()
}) {
VStack(alignment: .leading) {
HStack(alignment: .top, spacing: 4) {
Label("Set Daily Reminders", systemImage: "alarm").foregroundColor(Color("TextColor"))
.font(.system(.headline, design: .rounded))
Spacer()
}
}
}
.sheet(isPresented: $notificationsSettingsSheet) {
NotificationSettingsModal()
}
}
Run Code Online (Sandbox Code Playgroud)
通知设置模式:
var body: some View {
ZStack(alignment: .bottom) {
ScrollView {
VStack(alignment: .leading, spacing: 0) {
Text("Daily Reminders")
.font(.system(.title, design: .rounded))
.fontWeight(.bold)
.padding(.top, headingTopPadding)
.padding(.horizontal, headingHorizontalPadding).foregroundColor(Color("TextColor"))
Spacer().frame(height: 164)
}.frame(minWidth: 0, maxWidth: .infinity, minHeight: 0, maxHeight: .infinity)
Spacer().frame(height: 64)
}
}.background(Color("BackgroundColor").edgesIgnoringSafeArea(.all))
}
Run Code Online (Sandbox Code Playgroud)
当我启动应用程序并打开工作表时,在大约 50% 的情况下,工作表会在大约半秒后自行消失。如果我之后打开工作表,一切都会正常。什么会导致这个问题?
小智 0
本周,我通过在 homeView 上设置 NavigationView 时删除下面的代码解决了这个问题,这导致我的子视图的工作表在第一次显示时自动消失。
NavigationView {...}
// .navigationViewStyle(StackNavigationViewStyle())
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
2313 次 |
最近记录: |