title: Using slider in custom cell of a UITableView
body: <p>I have a UITableView which has prototype <code>cells</code> which include a slider and a <code>textfield</code> next to it. As the slider's value changes, the value inside the <code>textview</code> is also changed. It works fine except for when the size of the table increases, the new <code>cell</code> generated when scrolling down is already shows the value of the first cell. I do realize that this has something to do with the <code>dequeueReusableCellWithIdentifier</code> function as the <code>cells</code> are reused. How can this be circumvented? </p>
  
  <p>This is the code:</p>
  
  <pre><code>func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -&gt; UITableViewCell {
  
      let cell = self.tableView.dequeueReusableCellWithIdentifier("infoCell") as! InfoCell
  
      cell.dressLabel.text = inputArrayFortableView[indexPath.row]
  
      cell.uiSlider.maximumValue = 100
      cell.uiSlider.minimumValue = 0
      cell.uiSlider.continuous = true
      cell.uiSlider.addTarget(cell, action: #selector(cell.uiSliderSetValue), forControlEvents: .ValueChanged)
  
      if(cell.DressTextField.text != "")
          {
              cell.uiSlider.setValue(Float(cell.DressTextField.text!)!, animated: true)
          }
  
      print("outside uisliderSetvalue")
      cell.uiSlider.tag = indexPath.row
      print(cell.uiSlider.tag)
  
      return cell
  
  }
  </code></pre>
  
  <p>I am attaching a screenshot. Keep in mind the when I scroll downwards, the new cell has the same value as that of the first one, the second cell generated has the same value as that of the second and so on.</p>
  
  <p><a href="https://i.stack.imgur.com/l7b4C.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/l7b4C.png" alt="enter image description here"></a></p>