【发布时间】:2021-04-24 02:47:05
【问题描述】:
如何使登录视图展开,使其左侧被限制在左侧,而右侧也被限制在右侧?
import SwiftUI
struct Intro: View {
var body: some View {
ZStack {
Image("IntroImage")
.resizable()
.aspectRatio(contentMode: .fill)
.frame(alignment: .center)
VStack {
Spacer()
Button(action: {}, label: {
Text("Sign in")
.foregroundColor(Color.black)
.padding()
.background(Color.green)
})
}
}
.ignoresSafeArea()
}
}
struct Intro_Previews: PreviewProvider {
static var previews: some View {
Intro()
}
}
我使用的是 640 × 1136 png 的图像。我正在包括 iPhone 11 在内的所有设备上对其进行测试。
【问题讨论】: