title: The two nsmutablearray value is getting swap with another in ios
body: <p>I am inserting <code>NSMutableArray(self.tablePdfListArray)</code> in <code>tableview textlabel</code> and <code>NSMutableArray(self.dateListArray)</code> in <code>detailtextlabel</code> at same index. It got added correctly at first place but when I am opening the <code>TableView</code> again the <code>detailTextlabel</code> becoming <code>textlabel</code> and <code>textlabel</code> is becoming <code>detailTextlabel</code>. </p>
  
  <p>I have <code>NSLog</code> both the <code>NSMutabelArray</code> and come to know that both array value are getting swap. How to retain its original values? Thanks in advance for any suggestion.
  <strong>Edited With tableView code</strong> </p>
  
  <pre><code> - (void)viewDidLoad
   {
   if([[NSUserDefaults standardUserDefaults] objectForKey:@"children"] != nil )
  {
      self.tablePdfListArray = [NSMutableArray arrayWithArray:[[NSUserDefaults standardUserDefaults] objectForKey:@"children"]];
  
  }
  if ([[NSUserDefaults standardUserDefaults] objectForKey:@"dates"] != nil)
  {
      self.dateListArray = [NSMutableArray arrayWithArray:[[NSUserDefaults standardUserDefaults] objectForKey:@"dates"]];
  
  }
  }
    -(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
  if (buttonIndex == 0)
  {
    self.myPDFName = [NSString stringWithFormat:@"%@", [alertView textFieldAtIndex:0].text];
  
      firstDayInYear = [NSDate date];
      dateFormatter = [[NSDateFormatter alloc] init];
      [dateFormatter setTimeStyle:NSDateFormatterShortStyle];
      [dateFormatter setDateStyle:NSDateFormatterMediumStyle];
      NSString *currentTime = [dateFormatter stringFromDate:firstDayInYear];
      NSLog(@"User's current time in their preference format:%@",currentTime);
  
      if(!self. tablePdfListArray)
      {
  
          self.tablePdfListArray = [[NSMutableArray alloc]init];
      }
      if(!self.dateListArray)
      {
          self.dateListArray = [[NSMutableArray alloc]init];
      }
      [self.dateListArray insertObject:currentTime atIndex:0];
  
      NSLog(@"mhy date dateListArray %@",dateListArray);
  
       //the below if condition will not allow repeatative string array in tableList and textfield lenth.
             if ([[alertView textFieldAtIndex:0].text length] != 0 &amp;&amp; ![self.tablePdfListArray containsObject:self.myPDFName])
      {
  
          [self.tablePdfListArray insertObject:[NSString stringWithFormat:@"%@", [alertView textFieldAtIndex:0].text] atIndex:0];
  
                     NSLog(@"mhy date tablePdfListArray %@",tablePdfListArray);
          NSIndexPath * indexPath = [NSIndexPath indexPathForRow:0 inSection:0];
  
          [self.pdfListnameTable insertRowsAtIndexPaths:@[indexPath]withRowAnimation:UITableViewRowAnimationAutomatic];
  
          NSUserDefaults *defaults=[NSUserDefaults standardUserDefaults];
          [defaults setObject:self.dateListArray forKey:[NSString stringWithFormat:@"children"]];
          [defaults setObject:self.tablePdfListArray forKey:[NSString stringWithFormat:@"dates"]];
          [defaults synchronize];
  
      }
    }}
  
   - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
  
  if( tableView == pdfListnameTable)
  {
  
      static NSString *CellIdentifier = @"Cell";
  
      UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
  
  
      if (cell == nil)
      {
          cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
  
          cell.selectionStyle = UITableViewCellSelectionStyleNone;           //cell bg
          //self.myChklist.backgroundColor = [UIColor clearColor];
  
      }
  
      NSString *tablePdfname = [self.tablePdfListArray objectAtIndex:indexPath.row];
      cell.textLabel.text = tablePdfname;
  
      NSString *tablePdfdate = [self.dateListArray objectAtIndex:indexPath.row];
              //[dateFormatter setTimeStyle:NSDateFormatterMediumStyle];
  
  
  
         cell.detailTextLabel.text = tablePdfdate;
  
      return cell;
  
   }
   }
  </code></pre>