簡體   English   中英

是否可以重新加載UITableView(節的特定行除外)?

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM