I wanted to change background color of the whole screen(including safe area) in SwiftUI.
Adding following code to outermost view works for all the views except if given view contains List
.frame(maxWidth: .infinity, maxHeight: .infinity)
.background(Color.red)
I wanted to add background color for the full screen containing List. I have tried multiple things like,
Adding ZStack
with first element as Color.red
, but not worked
Color.red
with List
as an overlay, but it still not worked.
Only thing working for me is converting List
to ScrollView
, but that I don't want.
Do anyone have any other solution to make that work, or Apple doesn't provide anyway to change background color for List
?(should support atleast from iOS14 to latest)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.