I have a table with two sections. I can select row at index - but I cannot differentiate between the sections.
the table is a pullout menu - which is created solely in code.
the delegate method for the selection is
func sideBarControlDidSelectRow(indexPath: NSIndexPath) {
delegate?.sideBarDidSelectButtonAtIndex(indexPath.row)
sectionis = indexPath.section
NSLog("Index Path Section %d", indexPath.section)
}
this gives me the section in the console.
but on the view controller all I have is
func sideBarDidSelectButtonAtIndex(index: Int){
switch(index) {
etc.
}
}
What I need to be able to do is something like
func sideBarDidSelectButtonAtIndex(index: Int){
if section == 0 {
switch(index){
etc.
}
}
}
but if I try that then Binary operator cannot be applied to operands of type section
this has got to be something obvious as tables have sections all the time - but the answer is eluding me.
Just update declaration of method
sideBarDidSelectButtonAtIndex
in delegate protocol to accept NSIndexPath value, change:to
then you can just remove this method
and replace its call just with
Then you'll receive full indexPath and could do what you want