[英]Is it possible to reload UITableView except particular rows of section?
我正在嘗試重新加載UITableView
特定section
,但是它無法正常工作,意味着所有section
都正在重新加載。 如何解決這個問題
碼:
UIView.performWithoutAnimation({
let loc = self.cartTbl.contentOffset
self.cartTbl.reloadSections(IndexSet(integer: sender.tag), with: .middle);
self.cartTbl.contentOffset = loc
})
這里sender.tag
表示點擊按鈕時正在傳遞段號
let sectionIndex = 1
let set: IndexSet = [sectionIndex]
self.tableView.reloadSections(set, with: .automatic)
您可以使用表格視圖的reload節方法。
您是否正在使用reloadSections
方法更新特定部分? 使用reloadSections
方法,您可以重新加載特定的部分,而無需重新加載表的其他部分。
https://developer.apple.com/documentation/uikit/uitableview/1614954-reloadsections?language=objc
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.