代码之家  ›  专栏  ›  技术社区  ›  nishanthshanmugham

在SwiftUI中的设置下方添加解释/说明文本

  •  0
  • nishanthshanmugham  · 技术社区  · 2 年前

    在SwiftUI中,向设置中添加“解释”文本的标准方式(或推荐方式)是什么。例如,在system Maps(系统地图)应用程序设置下面的屏幕截图中,限速切换下面有以下解释文本:

    速度限制信息将在可用时显示。

    settings screen shot

    1 回复  |  直到 2 年前
        1
  •  1
  •   burnsi    2 年前

    如果你想要像你发布的图片一样的东西,试试看 Form 。它可以包含多个 Section 您可以提供 header 和a footer 看法

    documentation

    示例:

    struct TestView: View{
        var body: some View{
            Form{
                Section {
                    Text("content")
                } header: {
                    Text("header")
                } footer: {
                    Text("footer")
                }
            }
    
        }
    }
    

    exmaple