[英]How to change Background Color of a View containing a List back to White in SwiftUI
[英]Adding background color for full screen containing List/Tableview in swiftUI
我想在 SwiftUI 中更改整个屏幕(包括安全区域)的背景颜色。
将以下代码添加到最外层视图适用于所有视图,除非给定视图包含List
.frame(maxWidth: .infinity, maxHeight: .infinity)
.background(Color.red)
我想为包含列表的全屏添加背景颜色。 我尝试了多种方法,例如,
添加ZStack
与第一个元素作为Color.red
,但没有奏效
Color.red
与List
作为覆盖,但它仍然不起作用。
唯一对我有用的是将List
转换为ScrollView
,但我不想要。
有没有人有任何其他的解决方案来完成这项工作,或者 Apple 无论如何都不提供更改List
的背景颜色?(至少应该支持从 iOS14 到最新的)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.