Giridhar
Giridhar

Reputation: 512

How to delete/remove a section and it's rows in UITableView on demand in IOS APP using swift2+

I am trying to delete a section and it's rows in UITableView when user clicks on delete icon shown in section.

One solution i know, is delete object from array and reload the table, but this is not a process effective solution.

Upvotes: 2

Views: 3997

Answers (1)

Chris
Chris

Reputation: 1750

Delete the section with the built in tableView method after deleting the data from the datasource.

datasource.deleteSection()
tableView.deleteSections(NSIndexSet(index: sectionIndex), withRowAnimation: .Automatic)

Upvotes: 2

Related Questions