swift - UITableView - Multiple selection AND single selection -
i have 2 sections in uitableview.
want first section allow multiple cell selection , second section allow single selection.
tried code didn't work well.
code in swift if possible. thank you.
perhaps implement table view's delegate methods:
tableview(_:shouldhighlightrowatindexpath:)
and
tableview(_:didselectrowatindexpath:)
...and determine (from indexpath.row , indexpath.section) if relevant section supports single/multiple selection (this depend on data model's custom logic -e.g.: "section 0 supports multiple selection section 1 not"), , if supports single selection, check whether there row selected (by accessing tableview.indexpathsforselectedrows).
if there selected row already, can:
- return
falsetableview(_:shouldhighlightrowatindexpath:), , - do nothing (just
return)tableview(_:didselectrowatindexpath:)(i'm not sure if method called when returnfalseshouldhighlight..., perhaps check it).

Comments
Post a Comment