简体   繁体   English

滚动tableview时,其单元格会自动更新如何停止更新单元格?

[英]When I Scroll tableview its cell updated automatically How can i stop to update cell?

When I Scroll tableview its cell updated automatically. 当我滚动tableview其单元格会自动更新。

How can i stop to update cell? 我如何停止更新单元格?

My code snippet: 我的代码段:

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell
    {
        let cell = tableview.dequeueReusableCell(withIdentifier: Constant.FAV_CAROUSEL_CELL_IDENTIFIER, for: indexPath) as! carouselFavCell

        let objProvider1 = objProvider.providerArr[indexPath.row] as! ProviderModel
        self.providerArr = objProvider.providerArr[indexPath.row] as! ProviderModel
        self.apointmentArr = objProvider1.appointmentArr
        self.serviceArr = objProvider1.serviceArr

        cell.caroudelView.reloadData()

        cell.caroudelView.type = .linear
        cell.caroudelView.tag = indexPath.row

        cell.selectionStyle = .none
        cell.contentView.backgroundColor = Constant.CELL_BG_COLOR

        cell.caroudelView.backgroundColor = Constant.CELL_BG_COLOR
        cell.lblProviderName.text = objProvider1.providerName

        cell.lblProviderName.textColor = Constant.LBL_TITLE_DARK_GRAY
        cell.lblProviderName.font = UIFont.boldSystemFont(ofSize: 15)

        cell.btnMenu.setBackgroundImage(UIImage(named: "option1.png"), for: .normal)

        cell.buttonAction = { (sender) in
            self.providerArr = self.objProvider.providerArr[indexPath.row] as! ProviderModel
            self.actionPicker()
        }
    return cell
}

Try getting rid of the following line: 尝试摆脱以下行:

cell.caroudelView.reloadData()

Without this line, I guess, the cells will only have the value they get when they first appear. 我想如果没有这一行,单元格将仅具有它们首次出现时所获得的值。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 当我滚动tableView时,如何知道哪个单元格触及绿色区域 - When I Scroll the tableView, how can I know which cell is touch the Green Area 当我在tableView中选择一个单元格时如何停止UIView背景色消失 - How can I stop UIView background colour from disappearing when I select a cell in tableView 有时,当我在表视图中滚动时,表视图单元格中设置了错误的图像。 我怎样才能解决这个问题? - Wrong image is set in my tableview cell sometimes when I scroll on my tableview. How can I fix this? 如何从-(void)方法更新表格视图单元格? - How can I update a tableview cell from a -(void) method? 如何维护TableView滚动以停止重复使用单元格 - How to maintain tableview scroll to stop reusing cell 如何在可重复使用的tableView单元格中更新UITextfield中的文本值,每个单元格中具有不同的值 - How can I update the text values in the UITextfield in a reusable tableView cell, with different values in each cell 如何创建动态tableView单元格? - How can I create a dynamically tableView cell? 如何在表格视图单元格中使用开关? - How can I use a switch in a tableview cell? 单击 TableView 中的单元格时如何显示新的详细信息单元格? - How can show a new detail cell when i click on cell in TableView? 如何在“自定义表格视图”单元格下创建表格视图 - How can I Create a Tableview Under Custom Tableview cell
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM