swift - 如何从 WatchOS 中的 SwiftUI 列表中删除分隔符?

标签 swift swiftui watchos

如何从 WatchOS 的 SwiftUI 列表中删除分隔符?

我在 stackoverflow 上查看了一些答案,他们建议使用

UITableView.appearance().tableFooterView = UIView()
UITableView.appearance().separatorStyle = .none

看起来它们只适用于 iOS,显然不适用于 WatchOS SwiftUI 列表。有什么办法可以自定义吗?

编辑-

UITableView.appearance().separatorStyle = .none

显然上面的代码在 iOS 14 中并没有隐藏分隔符。

最佳答案

我不确定 WatchOS 列表上的分隔符是什么意思,但可能您只需要为第一行设置如下所示的盘片颜色

enter image description here

var body: some View {
    List {
        Text("Hello, World!").listRowPlatterColor(Color.black)
        Text("Hello, World!")
        Text("Hello, World!")
    }
}

关于swift - 如何从 WatchOS 中的 SwiftUI 列表中删除分隔符?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60063400/

相关文章:

ios - Chartboost SDK Swift 集成

swift - 是否建议在 "extension String"中存储常量 String

swift - 使用 combine's Publisher 在 SwiftUI Image 中从远程 URL 异步加载图像

swift - 通过 AVAudioRecorder 在 WatchOS 上录制音频

json - 快速解析响应时出现问题?

ios - 确定视频文件的路径

swiftui - 在 SwiftUI 文本中获取单词的框架

ios - 如何在 Windows 上使用 SwiftUI 制作 iOS 应用程序?

xcode - WatchKit 2.0 应用程序的包 ID person.bundle.Ropes.watchkitapp 没有以父应用程序的包 ID 为前缀,后跟 '.' ;预期的前缀

ios - WatchKit 项目无法识别 presentAudioRecordingControllerWithOutputURL