防止MacOS杆有侧边栏
默认情况下,将第一个列表添加到视图中似乎已设置为侧边栏。即使您不专门调用.listStyle(sideBarlistStyle())
。
您在视图上设置的列表是否有任何方法(即使是第一个视图)未设置为侧边栏? Apple的文档没有任何迹象,我试图为列表无法使用的任何样式。
因此,而不是像这样的列表:
应该看起来像:
编辑:
是的,代码。任何简单的代码都会做。
struct ContentView: View {
var body: some View {
List {
NavigationLink(
destination: TextEView(),
) {
Text("One")
}
}
}
}
struct TextEView: View {
@State private var fullText: String = "This is some editable text..."
var body: some View {
TextEditor(text: $fullText)
}
}
By default the first list added to a view seems to be set to sidebar. Even if you don't specifically call .listStyle(SidebarListStyle())
.
Is there any way that the list you set on the view (even if it's the first view) is not set to a sidebar? There is no indication on the Apple's documentation, and anything I have tried to style the list is not working.
So instead of the list looking like this:
It should look like:
Edit:
Yes, code. Any simple code will do.
struct ContentView: View {
var body: some View {
List {
NavigationLink(
destination: TextEView(),
) {
Text("One")
}
}
}
}
struct TextEView: View {
@State private var fullText: String = "This is some editable text..."
var body: some View {
TextEditor(text: $fullText)
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对于您的情况尝试
For your case try