Another solution instead of tableView.reloadData()

前端 未结 2 1163
时光说笑
时光说笑 2021-01-24 04:55

I am calling batch updates(begin/end updates) on a tableView using this code:

  let oldImageSet = Set(oldImageArray)
  let newImageSet = Set(self.images)
  let m         


        
2条回答
  •  长发绾君心
    2021-01-24 05:49

    func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
        return 55
    }
    
    func numberOfSections(in tableView: UITableView) -> Int {
    
        return posts.count
    }
    
    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return 1
    }
    

    replace code with following code :

    func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
        return 55
    }
    
    func numberOfSections(in tableView: UITableView) -> Int {
    
        return 1
    }
    
    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return posts.count
    }
    

提交回复
热议问题