【发布时间】:2022-07-05 17:20:20
【问题描述】:
我是Swift的新手,请帮帮我
第一个问题是可以在TabView 中使用TabView 吗?
如果可以,我遇到了与 List 相关的问题,当我点击另一个地方时,List 中的项目会突出显示
// This tab will have many pages and can swap left/right to change tabs
struct Tab1: View {
var body: some View {
TabView(selection: $otherSelected) {
SubOfTab1()
.tag("tag1")
... other tabs
}
.tabViewStyle(PageTabViewStyle(indexDisplayMode: .never))
}
}
// This tabview will display tab item as bottom
struct ContentView: View {
var body: some View {
TabView(selection: $selected) {
var body: some View {
Tab1()
.tag("tagParent1")
... other tabs
}
}
}
}
struct SubOfTab1: View {
VStack {
Text("Try to tab this text") ------> Try to tab this and all list items below is hightlighted??? why???
.frame(height: 100)
List() {
Text("XX")
Text("XX")
Text("XX")
Text("XX")
...
}
}
}
第一次运行
【问题讨论】: