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.

enter image description here

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:

  1. return false tableview(_:shouldhighlightrowatindexpath:), ,
  2. do nothing (just return) tableview(_:didselectrowatindexpath:) (i'm not sure if method called when return false shouldhighlight..., perhaps check it).

Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -