我有一個 HStack,它上面似乎有一些小區域(紅色區域上方的白色區域),有點沒有被背景覆寫。無論我使用哪一種,它的顏色都保持不變。在暗模式下,該區域使用背景顏色,這就是為什么不可見但可以在除錯視圖中檢測到的原因。
var body: some View {
NavigationView {
VStack {
Form {
ForEach(sections) { section in
Section {
PricesFilterMenuSectionView(items: section.items)
} header: {
Text(section.translation)
.font(.title3.weight(.bold))
.foregroundColor(.primary)
.textCase(nil)
} footer: {
if section != sections.last {
VStack(spacing: 0) {
Divider().padding(.top, Layout.dividerTopPadding)
}
}
}
}
}
.navigationBarTitle(Text(title), displayMode: .inline)
.navigationBarItems(leading: Button(action: dismissAction, label: { Image(systemName: "xmark").foregroundColor(.primary) }))
/////// This HStack
HStack {
Button(action: {
sections.forEach { section in
section.items.forEach { item in
item.isSelected = false
}
}
}, label: {
Text("clear_filters".localized).foregroundColor(ThemeManager.current.secondaryColor.color)
})
Spacer()
Button {
let tags = sections.flatMap { section in
section.items.compactMap { item -> Int? in
item.isSelected ? item.id : nil
}
}
showAction(tags)
} label: {
Text("show_results".localized)
}
.buttonStyle(PrimaryButtonStyle())
}
.padding(.horizontal, Layout.ctaStackHorizontalPadding)
.padding(.top)
.background((colorScheme == .dark ? Color(UIColor.red) : Color.red).ignoresSafeArea())
.compositingGroup()
// .shadow(color: colorScheme == .dark ? .black : .gray, radius: 15, x: 0, y: 0)
}
}
}

uj5u.com熱心網友回復:
在之后的行NavigationView {
改變這個:
VStack {
對此:
VStack(spacing: 0) {
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/515422.html
標籤:IOS迅捷堆栈
