How to Design a UITableView with Multiple Selection

How to Design a UITableView with
                                    Multiple Selection

How to Design a UITableView with Multiple Selection :-

Design UITableView in your StoryBoard Select your TableView and set selection option as Multiple Selection Select your UITableViewCell and set Identifier and Class fields.

In your ViewController file Create Interface for UITableViewCell and set IBOutlet for UIImageView and UILabel

In your ViewController file Create Implementation for UITableViewCell Set Delegate, DataSource for UITableView

  • UITableViewDelegate Methods:- 1.numberOfRowsInSection func numberOfSections(in tableView: UITableView) -> Int { return 5 }
  • 2.cellForRowAt Method func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell:UITableViewCell = self.tableView.dequeueReusableCell(withIdentifier: cellReuseIdentifier) as UITableViewCell! // set the text from the data model return cell }

    In this below screen didselect method used only selected row not working with and unselected row .

    3.didSelectRowAtIndexPath method:- func tableView(_ tableView: UITableView, didSelectRowAtIndexPath indexPath: IndexPath) { //Code for selected row and navigate } It method use for in above screen for multiple row selected and unselected .

    I Hope you enjoy this blog

    Thank You

    Want a Team that Delivers Result ? Connect now with us.

    -

    Our Offices

    INDIA

    F-429, Phase 8B, Industrial Area, SAS Nagar, Punjab 160059

    +91 82198-18163

    USA

    13506 Summerport Village Pky Suite 355 Windermere, FL 34786

    +1 (321) 900-0079

    CANADA

    15 Meltwater Cres, Brampton L6P3V8

    +1 (647) 892-6147