Duplication in values of tableView when Scrolling Swift

后端 未结 3 1220
情深已故
情深已故 2021-01-14 06:33

I have a tableView to display timings of week days

timingsArray is used in tableView to display timings

timingsArray of type timingObj

cla         


        
3条回答
  •  迷失自我
    2021-01-14 07:17

    Adding a prepareForReuse method to your cell class in which you reset the cell to it's initial state has the same effect as @CH Uck's answer

    For example:

    func prepareForReuse() {
       super.prepareForReuse()
       self.dayLabel.text = ""
       self.timeLabel.text = ""
    }
    

    See also: prepareForReuse in Apple developer documentation.

提交回复
热议问题