Narex
Narex

Reputation: 9

Is it possible to reload UITableView except particular rows of section?

I am trying to reload particular section of UITableView but it's not working properly means all sections are reloading. How to fix that issue

Code:

UIView.performWithoutAnimation({ 
  let loc = self.cartTbl.contentOffset 
  self.cartTbl.reloadSections(IndexSet(integer: sender.tag), with: .middle);
  self.cartTbl.contentOffset = loc 
}) 

here sender.tag means am passing section number on button click

Upvotes: 0

Views: 73

Answers (2)

jegadeesh
jegadeesh

Reputation: 945

let sectionIndex = 1
let set: IndexSet = [sectionIndex]
self.tableView.reloadSections(set, with: .automatic)

You can use reload section method of table view.

Upvotes: 2

Gurdev Singh
Gurdev Singh

Reputation: 2165

Are you using reloadSections method for updating a specific section? With the method reloadSections you can reload a specific section without reloading other sections of the table.

https://developer.apple.com/documentation/uikit/uitableview/1614954-reloadsections?language=objc

Upvotes: 0

Related Questions