Is there a way to force a refresh of just a single header in UITableView?

后端 未结 4 948
半阙折子戏
半阙折子戏 2021-02-14 00:11

I have a UITableView where I want to force a refresh of just a specific section header row, not the data rows. For example, refresh the header for section 3. I know how to reloa

4条回答
  •  名媛妹妹
    2021-02-14 00:40

    Well, in my case, after some asynchronous task i need to update my custom section header view.

    and I get it to update it's height using : This Swift 3+ Code

    //to reload your cell data
    self.tableView.reloadData()
    DispatchQueue.main.async {
    // this is needed to update a specific tableview's headerview layout on main queue otherwise it's won't update perfectly cause reloaddata() is called
      self.tableView.beginUpdates()
      self.tableView.endUpdates()
    }        
    

提交回复
热议问题