【发布时间】:2021-06-12 15:01:47
【问题描述】:
我是 SwiftUI 的新手。
我的目标是让List which listStyle is SidebarListStyle 就像这样
[第一][1]
这是我的代码
List{
MyProfile()
Section(header:
Text("친구 102")
.font(.footnote)
.foregroundColor(.secondary)
){
FriendsList()
} // Section
} // List
.listStyle(SidebarListStyle())
但如果我把这段代码放在NavigationView 中,listStyle 会在我无意中改变
[第二][2]
和代码
NavigationView{
List{
MyProfile()
Section(header:
Text("친구 102")
.font(.footnote)
.foregroundColor(.secondary)
){
FriendsList()
} // Section
} // List
.listStyle(SidebarListStyle())
}
有什么帮助吗? [1]:https://i.stack.imgur.com/awX3H.png [2]:https://i.stack.imgur.com/vMBZn.png
【问题讨论】:
-
你能不能写下MyProfile和FriendList的代码
标签: ios swift swiftui swiftui-list swiftui-navigationview