小编fak*_*iho的帖子

演示 - 在 SwiftUI 顶部显示视图(我不想导航)

嘿,我想在视图中间显示一个自定义视图我尝试添加 ZStack 并居中,但不起作用..这是我的代码

 var body: some View {
        VStack(alignment: .leading, spacing: 8) {
            headerView.padding().background(Color.white)
            ZStack(alignment: .center) {
                if(incomeFill_show) {
                    BudgetAlert(amount: .constant("400"))
                }

                List() {
                    VStack {
                        Section(header: self.getHeaderView()) {
                            ForEach(categoriesData) { category in
                                HStack(alignment: .bottom) {
                                    CategoryProgressView(category: category, value: .constant(.random(in: 0.1 ... 1)))
                                    self.valuesText(category: category)
                                }

                            }
                            .colorMultiply(Colors.SharedColors.backgroundColor)
                        }
                    }
                }
                .colorMultiply(Colors.SharedColors.backgroundColor)
                .onAppear {UITableView.appearance().separatorStyle = .none}
                .onDisappear { UITableView.appearance().separatorStyle = .singleLine }
            }


        }.background(Colors.SharedColors.backgroundColor)
    }
Run Code Online (Sandbox Code Playgroud)

我想要的只是显示BudgetAlert()具有模糊背景,如下所示:

在此输入图像描述

swift swiftui

5
推荐指数
1
解决办法
6444
查看次数

标签 统计

swift ×1

swiftui ×1