Reputation: 9
I am trying to reload particular section
of UITableView
but it's not working properly means all section
s 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
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
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