【发布时间】:2020-09-12 04:36:29
【问题描述】:
表格中有 5 个部分。除了第一个和第二个部分之外的所有部分都有一个视图标题。这个视图是使用 xib 制作的。它有一个标签和一个按钮。在每个部分中,此标签和按钮都会更改文本。 我怎样才能实现这个?。我在一个单独的文件中设置了这个快捷方式和按钮的文本。但是我不明白如何在每个部分中显示相应的文本。
enum header: Int, CaseIterable {
case oneSection
case twoSection
case thirdSection
case fourthSection
case fifthSection
var title:String {
switch self {
case .oneSection:
return ""
case .twoSection:
return ""
case .thirdSection:
return "thirdSection"
case .fourthSection:
return "fourthSection"
case .fifthSection:
return "fifthSection"
}
}
}
【问题讨论】:
标签: ios swift uitableview header switch-statement