Reload Table view cell with animation (Swift)

前端 未结 4 1903
南笙
南笙 2021-02-04 06:57

Is there a way to reload specific UITableView cells with multiple sections with animations?

I\'ve been using:

self.TheTableView.reloadSect         


        
4条回答
  •  不知归路
    2021-02-04 07:31

    the define IndexSet in official document:

    Manages a Set of integer values, which are commonly used as an index type in Cocoa API. The range of valid integer values is in (0, INT_MAX-1). Anything outside this range is an error.

    so IndexSet is Set about index, just putting some Int values in [ ]

    // for reload one section
    tableView.reloadSections([section], with: .automatic)
    // or using like this
    tableView.reloadSections(IndexSet(integer: section), with: .automatic)
    
    // for reload multi sections
    tableView.reloadSections([1, 2, 3, section], with: .automatic)
    

提交回复
热议问题