【发布时间】:2021-09-22 05:06:17
【问题描述】:
这里看看符号框是如何离开页面的:
我的代码:
ZStack {
Image("night").ignoresSafeArea()
VStack {
Spacer().frame(height: 260)
Text("Melbourne, Victoria")
.font(.largeTitle)
.fontWeight(.bold)
.foregroundColor(Color.white)
Spacer().frame(height: 25)
Image(systemName: "moon.fill")
.foregroundColor(Color.white)
.font(.system(size: 60))
Spacer()
Text("Today")
.font(.title)
.fontWeight(.medium)
.foregroundColor(Color.white)
Text("34°C")
.font(.title3)
.fontWeight(.medium)
.foregroundColor(Color.white)
Spacer().frame(height: 780)
HStack {
Image(systemName: "sun.max.fill")
.foregroundColor(Color.white)
.font(.system(size: 60))
}
}
}
如您所见,我放置了 SF 符号,但在预览中它离开了页面。有什么办法解决吗?
【问题讨论】:
-
您明确将垫片的高度设置为 780。删除框架修饰符。