更新时间:2022-04-20 21:09:04
确定,如下所述,添加 .frame
调用可以使背景图像按需要显示.
Ok, it turns our that adding the .frame
call as follows allows the the background image to display as desired.
(特别注意, .frame
调用省略了 height
参数.在以前的许多尝试中,都解决了该高度问题,从而导致了不同的不良行为)
(Note specifically that the .frame
call omits the height
argument. In many previous tries to solve this the height was included, leading to the different undesired behaviour)
.background(
Image("bricks")
.resizable()
.scaledToFill()
.frame(width: geometry.size.width)
.edgesIgnoringSafeArea(.all)
)