【发布时间】:2015-06-14 21:45:06
【问题描述】:
我有一张有两个部分的桌子。我可以在索引处选择行 - 但我无法区分各个部分。
表格是一个拉出式菜单 - 仅在代码中创建。
选择的委托方法是
func sideBarControlDidSelectRow(indexPath: NSIndexPath) {
delegate?.sideBarDidSelectButtonAtIndex(indexPath.row)
sectionis = indexPath.section
NSLog("Index Path Section %d", indexPath.section)
}
这给了我控制台中的部分。
但在视图控制器上我只有
func sideBarDidSelectButtonAtIndex(index: Int){
switch(index) {
etc.
}
}
我需要做的就是像
func sideBarDidSelectButtonAtIndex(index: Int){
if section == 0 {
switch(index){
etc.
}
}
}
但是如果我尝试这样做,那么二元运算符就不能应用于 section 类型的操作数
这必须是显而易见的,因为表格总是有部分 - 但答案是我一直没有找到。
【问题讨论】:
标签: ios swift didselectrowatindexpath