gpt4 book ai didi

ios - Eureka 通过标签获取 SelectableSection

转载 作者:行者123 更新时间:2023-11-28 12:47:11 25 4
gpt4 key购买 nike

我有这个代码:

    form +++= SelectableSection<ImageCheckRow<String>, String>("branch_section", selectionType: .MultipleSelection) { section in
section.header = HeaderFooterView(title: "Branches")
}

for branch in sharedBranch.branchList {
form.last! <<< ImageCheckRow<String>(branch.name){ row in
row.title = branch.name
row.baseValue = branch.id
row.selectableValue = branch.name
row.value = nil
}
}

但我无法获取selectedRows,我试过了:

    let branch_section = self.form.sectionByTag("branch_section") as? SelectableSection<ImageCheckRow<String>, String>
print(branch_section)
print(branch_section.selectedRows())

都打印nil

最佳答案

为了做到这一点,你需要使用这个

form +++= SelectableSection<ImageCheckRow<String>, String>("branch_section", selectionType: .MultipleSelection)
form.last!.header = HeaderFooterView(title: "Branches")
form.last!.tag = "branch_section"

代替

form +++= SelectableSection<ImageCheckRow<String>, String>("branch_section", selectionType: .MultipleSelection) { section in
section.header = HeaderFooterView(title: "Branches")
}

然后是你的代码

let branch_section = self.form.sectionByTag("branch_section") as? SelectableSection<ImageCheckRow<String>, String>
print(branch_section)
print(branch_section.selectedRows())

会按预期工作,我希望这对你有帮助

关于ios - Eureka 通过标签获取 SelectableSection,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37680383/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com