我正在尝试制作一系列的帐户注册页面,并且我希望我的应用程序图标(图像)在页面上保持相同的位置,而当前它们并不需要。
我已经尝试使用间隔子来使它均匀,但是没有用。
第一视图:
var body: some View {
NavigationView {
VStack {
VStack {
Image("logo")
.resizable()
.scaledToFit()
}
VStack {
InformationTextField(iconName: "person.fill", headlineText: "USERNAME", textFieldDescription: "Enter username here", protected: false)
InformationTextField(iconName: "lock.fill", headlineText: "PASSWORD", textFieldDescription: "Enter password here", protected: true)
NavigationLink(destination: Text(
"ee")) {
ActionButton(text: "signup")
}
Divider()
.background(Color("DividerColor"))
Text("Don't have an account?")
.fontWeight(.light)
NavigationLink(destination: SignupPage()) {
ActionButton(text: "sign up")
}
}
}
.padding()
}
}
第二个视图:
var body: some View {
NavigationView {
VStack {
VStack {
Image("logo")
.resizable()
.scaledToFit()
}
VStack {
InformationTextField(iconName: "person.fill", headlineText: "USERNAME", textFieldDescription: "Enter username here", protected: false)
InformationTextField(iconName: "info.circle.fill", headlineText: "CONTACT", textFieldDescription: "Enter email or phone number here", protected: false)
InformationTextField(iconName: "calendar", headlineText: "AGE", textFieldDescription: "Enter birthday here", protected: false)
InformationTextField(iconName: "lock.fill", headlineText: "PASSWORD", textFieldDescription: "Enter password here", protected: true)
InformationTextField(iconName: "lock.fill", headlineText: "CONFIRM PASSWORD", textFieldDescription: "Re-enter password here", protected: true)
}
// .padding()
NavigationLink(destination: Text(
"ee")) {
ActionButton(text: "sign up")
}
}
.padding()
}
}
无论视图如何,我都希望徽标图像位于屏幕上完全相同的位置。我尝试的所有方法均无效。
答案 0 :(得分:0)
您可能应该尝试ZStack