我是 Swift UI 的新手,我將不勝感激。
現在我的應用程式設計如下圖所示
這是圖片請看
我的應用程式的代碼如下所示
var body: some View {
VStack(){
ZStack {
VStack(){
HStack(){
Text("All Savings Bank Accounts")
.font(.title2)
.frame( alignment: .top)
Button(" ") {
isSavingsFundsAlertsPresented = true
}.font(.title2)
.frame(alignment: .top)
}
Spacer()
List(allBankAccountFunds){
aRow in TableRowSavingsAccount(Account: aRow)
}
}
AlertView(isShown: $isSavingsFundsAlertsPresented, Name: $SavingAccountName, Amount: $SavingAccountAmount, title: "Add Savings Account", placeholder: "Name of Account", buttonText: "Add Account") {
if(SavingAccountName != ""){
let newAccount = SavingsAccount(context: context);
newAccount.accountName = SavingAccountName;
newAccount.accountBalance = Double(SavingAccountAmount) ?? 0;
do{
try context.save()
}catch{
print(error)
}
}
//after the alert has ended closure of on Done function
}
}
ZStack {
VStack{
即使我在 HStack 和 List 之間包含了 spacer(),Hstack 仍然很低,
我想要實作的只是以某種方式減少文本(“所有儲蓄銀行賬戶”)和一流之間的空間。
如果我嘗試忽略allsafeEdges(),Hstack 會完全消失。
我是 swiftUI 的新手,我們將不勝感激任何幫助。
uj5u.com熱心網友回復:
如果你在View里面顯示這個NavigationView,默認會NavigationBar出現。
如果你添加
.navigationBarTitle("")
.navigationBarHidden(true)
下面的,VStack將被隱藏。bodyNavigationBar
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/494328.html
