Reload tableView section without reloading header section - Swift Reload tableView section without reloading header section - Swift swift swift

Reload tableView section without reloading header section - Swift


You could use UITableView's reloadSections method instead.

tableView.reloadSections(IndexSet(integer: 2), with: .none)


Swift 3.0.1:

let sectionIndex = IndexSet(integer: 0)tableView.reloadSections(sectionIndex, with: .none) // or fade, right, left, top, bottom, none, middle, automatic


Swift 3.1 Xcode 8.3.3 Answer :)

The problem is - each section includes header of course, so section is:

section = header + footer + rows

The answer is - reload rows directly by IndexPath.Example:

  1. Let's say you've got 1 section in your table and 'array' of something you use as datasource for table:

    let indexes = (0..<array.count).map { IndexPath(row: $0, section: 0) }

  2. Now we've got array of indexes of cell we want to reload, so:

    tableView.reloadRows(at: indexes, with: .fade)