我的UITableView有两个分区,因此我创建了一个枚举来表示它们:
private enum TableSections {
HorizontalSection,
VerticalSection
}
我应该如何在numberOfRowsInSection委托方法中使用传递的“section”变量进行切换?看起来我需要将“section”强制转换为我的枚举类型?还是有更好的方法可以实现这一点?
错误信息为“在类型'int'中找不到枚举类型'HorizontalSection'的枚举情况。”
override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
switch section {
case .HorizontalSection:
return firstArray.count
case .VerticalSection:
return secondArray.count
default
return 0
}
}