title: Programmatically embed multiple UISlider and UILabel controls in UITableViewCells
body: <p>I'm an iOS Dev newbie and would appreciate any help with how to create multiple UISlider and UILabel controls in a UITableView programmatically, as illustrated:</p>
  
  <p><img src="https://i.stack.imgur.com/HoMBT.jpg" alt="mockup"></p>
  
  <p>As seen in the mockup pic above, I only need the relevant label text to be updated when corresponding slider (on the same row) is changed.</p>
  
  <p>Using the code below, I'm able to create multiple slider controls dynamically for each row in my table view but am not able to display the corresponding label and update this label text when the slider's value is changed.</p>
  
  <pre><code>- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
      static NSString *ControlRowIdentifier = @"ControlRowIdentifier";
  
      UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:ControlRowIdentifier];
      if (cell == nil) {
          cell = [[UITableViewCell alloc]
                  initWithStyle:UITableViewCellStyleDefault
                  reuseIdentifier:ControlRowIdentifier];
  
  
          CGRect frame = CGRectMake(0.0, 0.0, 100.0, 10.0);
          UISlider *slider = [[UISlider alloc] initWithFrame:frame];
          [slider addTarget:self action:@selector(sliderAction:) forControlEvents:UIControlEventValueChanged];
          [slider setBackgroundColor:[UIColor clearColor]];
          slider.minimumValue = 1;
          slider.maximumValue = 70;
          slider.continuous = YES;
          slider.value = 30;
  
          cell.accessoryView = slider;
      }
      NSUInteger row = [indexPath row];
      NSString *rowTitle = [list objectAtIndex:row];
      cell.textLabel.text = rowTitle;
  
      return cell;
  }
  
  //Does not work
  - (IBAction)sliderAction:(id)sender {
      UISlider *sliderControl = (UISlider *)sender;
      int SliderValue = (int)roundf(sliderControl.value);
      UILabel *sliderLabel;
      sliderLabel.text = [NSString stringWithFormat:@"%d", SliderValue];
      [self.view addSubview:sliderLabel];
  }
  </code></pre>