title: UiSegementedController's segment automatically select in UITableViewCell when scroll the uitableview
body: <p>I have added <code>UISegmentedController</code> to <code>TableViewCell</code> in <code>CellForRowAtIndexPath</code>. <br>
  Following is the code.</p>
  
  <pre><code>[cell.segStatus addTarget:self action:@selector(selectedSegmentControl:) forControlEvents: UIControlEventValueChanged];
  [cell.segStatus setSegmentedControlStyle:UISegmentedControlStyleBar];
  cell.segStatus.tag = indexPath.row;
  </code></pre>
  
  <p>I use <code>UITableViewCell</code> class for customized class.</p>
  
  <p>I select segment and when I scroll the tableview  some other cell's segmented controller  also automatically select.<br>
  Why is it? how can I sort out this ?</p>
  
  <p>Full CellForRowAtIndexPath Method</p>
  
  <pre><code>- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  {
    @try {
      static NSString *defTableIdentifier = @"DefectRegisterCell";
      DefectRegisterCell *cell = (DefectRegisterCell *)[self.tblDefectList dequeueReusableCellWithIdentifier:defTableIdentifier];
  
              _defectEntry = [defectObjList objectAtIndex:indexPath.row];
  
              cell.lblDefectNo.text = [NSString stringWithFormat:@"%@", _defectEntry.defectNo];
  
        if ([_defectEntry.defect isEqual:@"None"] || [_defectEntry.defect isEqual:@""] ) {
            cell.lblDefect.text = [NSString stringWithFormat:@"%@ - %@ - Passed", _defectEntry.item,_defectEntry.subItem];
        }
        else{
              cell.lblDefect.text = [NSString stringWithFormat:@"%@ - %@ - %@", _defectEntry.item,_defectEntry.subItem,_defectEntry.defect];
        }
              cell.lblLocation.text = @"Location:";
              cell.lblLocationValue.text = [NSString stringWithFormat:@"%@ &gt; %@ &gt; %@ &gt; %@  (%@ - %@)",_defectEntry.building, _defectEntry.area, _defectEntry.location, _defectEntry.room,_defectEntry.orient, _defectEntry.position];
  
              cell.lblAssignedTo.text = @"Assigned to:";
              cell.lblAssignedToValue.text = _defectEntry.responsibleComp;
  
              cell.lblDue.text = @"Due:";
              cell.lblDueValue.text = _defectEntry.dueDate;
  
              cell.lblCapturedBy.text = @"Recorded by:";
              cell.lblCapturedByValue.text =  [NSString stringWithFormat:@"%@ (%@)",_defectEntry.inspectedId,_defectEntry.inspectedCompId];
  
              cell.lblDate.text = @"On:";
              cell.lblDateValue.text = _defectEntry.createdDate;
              NSString *attached = @"0" ;
              NSString *fixClaimed = @"0";
              NSString *completed = @"0";
              if ([_defectEntry.attached length] &gt; 0) {
                  attached = @"1";
              }
              if ([_defectEntry.fixClaimed isEqualToString:@"Y"]) {
                  fixClaimed = @"1";
              }
  
              if ([_common checkDateValidation:_defectEntry.completed]) {
                  completed = @"1";
              }
  
            [cell.segStatus addTarget:self action:@selector(selectedSegmentControl:) forControlEvents: UIControlEventValueChanged];
            [cell.segStatus setSegmentedControlStyle:UISegmentedControlStyleBar];
            cell.segStatus.tag = indexPath.row;
  
              if ([attached isEqualToString:@"1"]) {
                  cell.imgAttachment.image = [UIImage imageNamed:@"diAttachments.png"];
  
              }
              if ([fixClaimed isEqualToString:@"1"]) {
                  cell.imgDefect.image = [UIImage imageNamed:@"diWarning.png"];
                  cell.segStatus.hidden = NO;
  
              } else  if ([completed isEqualToString:@"1"]) {
                  cell.imgDefect.image = [UIImage imageNamed:@"diRight.png"];
  
                  if ([_defectEntry.passed isEqualToString:@"Yes"]) {
                      cell.segStatus.hidden = YES;
                  }
                  else{
                      cell.segStatus.hidden = NO;
                  }
  
              } else {
                  cell.imgDefect.image = [UIImage imageNamed:@"diWrong.png"];
                  cell.segStatus.hidden = NO;
              }
  
              UIView *backgroundView = [[UIView alloc] init];
              if (indexPath.row % 2) {
                  backgroundView.backgroundColor = [UIColor whiteColor];
              } else {
                  backgroundView.backgroundColor = [UIColor colorWithRed:242/255.0f green:242/255.0f blue:242/255.0f alpha:1.0f];
              }
              cell.backgroundView = backgroundView;
  
              //change the selected cell color
              UIView *selectedBackgroundView = [[UIView alloc] init];
              selectedBackgroundView.backgroundColor = gaSelectedColor;
              cell.selectedBackgroundView = selectedBackgroundView;
        return cell;
      }
      @catch(NSException *excp)
      {
          NSLog(@"%@",excp);
      }
  }
  </code></pre>