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

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

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

android - How to create dynamically Fragment pager adapter -