ios - selectrow at index for different sections -
i have table 2 sections. can select row @ index - cannot differentiate between sections.
the table pullout menu - created solely in code.
the delegate method selection
func sidebarcontroldidselectrow(indexpath: nsindexpath) { delegate?.sidebardidselectbuttonatindex(indexpath.row) sectionis = indexpath.section nslog("index path section %d", indexpath.section) }
this gives me section in console.
but on view controller have
func sidebardidselectbuttonatindex(index: int){ switch(index) { etc. } }
what need able
func sidebardidselectbuttonatindex(index: int){ if section == 0 { switch(index){ etc. } } }
but if try binary operator cannot applied operands of type section
this has got obvious tables have sections time - answer eluding me.
just update declaration of method sidebardidselectbuttonatindex
in delegate protocol accept nsindexpath value, change:
func sidebardidselectbuttonatindex(index: int)
to
func sidebardidselectbuttonatindex(indexpath: nsindexpath)
then can remove method
func sidebarcontroldidselectrow(indexpath: nsindexpath) { delegate?.sidebardidselectbuttonatindex(indexpath.row) }
and replace call
delegate?.sidebardidselectbuttonatindex(indexpath)
then you'll receive full indexpath , want
Comments
Post a Comment