列表调用时不显示自定义视图

时间:2019-10-13 16:32:27

标签: swiftui

我试图显示垂直的自定义视图堆栈,代码构建良好,但是视图未显示在画布上。

$query = "SELECT * FROM Table
WHERE MONTH(yourColumn) = '.substr ( $this->NumMes, 0, 5 ).'"

上面是该列表,它调用每个费用项目的ExpenseRow自定义视图。 下面是调用ExpensesAndSavings()视图的主体视图,下面是ExpenseRow视图和Expense结构。

对于它为什么能够成功构建但根本没有出现在画布上的问题,我完全陷入僵局。

让我知道是否需要其他信息


struct ContentView: View {

    var expenses = [Expense]()
    //var savingsItems = [SavingsItem]

    init(){
        addNewExpense(withName: "Train Ticker", price: 88)
        addNewExpense(withName: "Spotify", price: 14)
        addNewExpense(withName: "Phone Bill", price: 20)
    }



    fileprivate func ExpensesAndSavingsView() -> some View {
        return VStack{
            VStack{

                List(expenses) { expense in
                    ExpenseRow(expense: expense)
                }
 var body: some View {
        VStack{
            ScrollView{
                VStack {

                    VStack{
                        Text("Monthly Income").font(.largeTitle)
                        TextField("Enter Monthly Income", text: $monthlyIncome)
                            .border(Color.black)
                            .padding(.horizontal, 50)
                            .textFieldStyle(RoundedBorderTextFieldStyle())
                    }.padding(30)

                    ExpensesAndSavingsView()
                }

            }
            HStack(alignment: .bottom){
                Text("Monthly Net")
                Spacer()
                Text("$1100")
            }.padding(50)
        }
    }

0 个答案:

没有答案